Skip to content

Commit

Permalink
Use configmap example for keepResources E2E tests
Browse files Browse the repository at this point in the history
This covers a similar use case but with a lower footprint than via a
full-blown example using Redis pods.
  • Loading branch information
weyfonk authored and manno committed Oct 17, 2023
1 parent 9c245e1 commit 5f3ad58
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions e2e/assets/keep-resources/do-not-keep/gitrepo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: dont-keep
spec:
repo: https://github.com/rancher/fleet-examples
repo: https://github.com/rancher/fleet-test-data
branch: master
paths:
- simple
- helm-verify
targetNamespace: do-not-keep-resources
targets:
- clusterSelector:
Expand Down
4 changes: 2 additions & 2 deletions e2e/assets/keep-resources/keep/gitrepo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: keep
spec:
repo: https://github.com/rancher/fleet-examples
repo: https://github.com/rancher/fleet-test-data
branch: master
paths:
- simple
- helm-verify
targetNamespace: keep-resources
keepResources: true
targets:
Expand Down
8 changes: 4 additions & 4 deletions e2e/keep-resources/keep_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var _ = Describe("Keep resources", func() {
out, err := k.Apply("-f", testenv.AssetPath(asset))
Expect(err).ToNot(HaveOccurred(), out)
Eventually(func() string {
out, _ := k.Namespace(namespace).Get("pods")
out, _ := k.Namespace(namespace).Get("configmaps")
return out
}).Should(ContainSubstring("frontend-"))
}).Should(ContainSubstring("app-config"))
})

When("GitRepo does not contain keepResources", func() {
Expand All @@ -38,7 +38,7 @@ var _ = Describe("Keep resources", func() {
Expect(err).ToNot(HaveOccurred(), out)

Eventually(func() string {
out, _ := k.Namespace(namespace).Get("deployments", "frontend")
out, _ := k.Namespace(namespace).Get("configmap", "app-config")
return out
}).Should(ContainSubstring("Error from server (NotFound)"))
})
Expand All @@ -62,7 +62,7 @@ var _ = Describe("Keep resources", func() {

By("checking resources are not deleted")
Eventually(func() string {
out, _ := k.Namespace(namespace).Get("deployments", "frontend", "-o", "yaml")
out, _ := k.Namespace(namespace).Get("configmap", "app-config", "-o", "yaml")
return out
}).Should(SatisfyAll(
Not(ContainSubstring("Error from server (NotFound)")),
Expand Down

0 comments on commit 5f3ad58

Please sign in to comment.