From 5f3ad5830bbf13c1484d6c3727801ca6fdda8628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20N=C3=A9au?= Date: Mon, 16 Oct 2023 16:26:02 +0200 Subject: [PATCH] Use configmap example for `keepResources` E2E tests This covers a similar use case but with a lower footprint than via a full-blown example using Redis pods. --- e2e/assets/keep-resources/do-not-keep/gitrepo.yaml | 4 ++-- e2e/assets/keep-resources/keep/gitrepo.yaml | 4 ++-- e2e/keep-resources/keep_resources_test.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/e2e/assets/keep-resources/do-not-keep/gitrepo.yaml b/e2e/assets/keep-resources/do-not-keep/gitrepo.yaml index 95c0d1100e..5855dbb853 100644 --- a/e2e/assets/keep-resources/do-not-keep/gitrepo.yaml +++ b/e2e/assets/keep-resources/do-not-keep/gitrepo.yaml @@ -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: diff --git a/e2e/assets/keep-resources/keep/gitrepo.yaml b/e2e/assets/keep-resources/keep/gitrepo.yaml index 64288ac12c..daaa7baf1b 100644 --- a/e2e/assets/keep-resources/keep/gitrepo.yaml +++ b/e2e/assets/keep-resources/keep/gitrepo.yaml @@ -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: diff --git a/e2e/keep-resources/keep_resources_test.go b/e2e/keep-resources/keep_resources_test.go index ef697baff3..35ce8a6a14 100644 --- a/e2e/keep-resources/keep_resources_test.go +++ b/e2e/keep-resources/keep_resources_test.go @@ -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() { @@ -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)")) }) @@ -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)")),