Skip to content

Commit

Permalink
Apply filters to spec restore operation (#5908)
Browse files Browse the repository at this point in the history
## Change Overview

This change applies RestoreAction filters prior to restoring any Kubernetes resources
and skips that operation if the filter doesn't allow it

## Pull request type

Please check the type of change your PR introduces:
- [ ] Work in Progress
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Trival/Minor
- [ ] Bugfix
- [x] Feature

## Issues

- K10-2225

## Test Plan

- [ ] Manual
- [ ] Unit test
- [x] World/Kube
- [ ] E2E

```
(restoreaction_namespace_filters) $ go test -check.vv -check.f=TestSnapshotRestoreWithFilters
START: world_test.go:63: KubeTestWorldSuite.SetUpSuite
2019/06/23 15:00:54 Serving catalog at http://127.0.0.1:62144
2019/06/23 15:00:54 Serving jobs at http://127.0.0.1:62146
2019/06/23 15:00:54 Serving metering at http://127.0.0.1:62143
2019/06/23 15:00:54 Serving compliance at http://127.0.0.1:62147
2019/06/23 15:00:54 Serving dashboardbff at http://127.0.0.1:62149
2019/06/23 15:00:54 Serving state at http://127.0.0.1:62145
2019/06/23 15:00:54 Serving jobsqueue at http://127.0.0.1:62148
I0623 15:00:54.426072   53223 secure_serving.go:116] Serving securely on [::]:8092
PASS: world_test.go:63: KubeTestWorldSuite.SetUpSuite	4.419s

START: world_test.go:158: KubeTestWorldSuite.TestSnapshotRestoreWithFilters
START: world_test.go:100: KubeTestWorldSuite.SetUpTest
PASS: world_test.go:100: KubeTestWorldSuite.SetUpTest	1.066s

START: world_test.go:124: KubeTestWorldSuite.TearDownTest
PASS: world_test.go:124: KubeTestWorldSuite.TearDownTest	0.075s

PASS: world_test.go:158: KubeTestWorldSuite.TestSnapshotRestoreWithFilters	173.380s

START: world_test.go:130: KubeTestWorldSuite.TearDownSuite
PASS: world_test.go:130: KubeTestWorldSuite.TearDownSuite	0.042s

OK: 1 passed
PASS
ok  	kio/test/world	179.259s
```
  • Loading branch information
Vaibhav Kamra authored Jun 23, 2019
1 parent 1a740e6 commit 2c72e6d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/filter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ func (s *FilterSuite) TestResourceIncludeExclude(c *C) {
include: []Resource{ss1, ss2, pvc1, pvc2},
exclude: []Resource{ss1, ss2, pvc1, pvc2},
},
{
// Empty matcher, include/exclude is a no-op
m: ResourceMatcher{},
resources: []Resource{ss1, ss2, pvc1, pvc2},
include: []Resource{ss1, ss2, pvc1, pvc2},
exclude: []Resource{ss1, ss2, pvc1, pvc2},
},
{
// Match all types
m: ResourceMatcher{
Expand Down

0 comments on commit 2c72e6d

Please sign in to comment.