diff --git a/tests/e2e/btrfs/btrfs_test.go b/tests/e2e/btrfs/btrfs_test.go index e45a97958609..4311dd65bc45 100644 --- a/tests/e2e/btrfs/btrfs_test.go +++ b/tests/e2e/btrfs/btrfs_test.go @@ -90,9 +90,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/dualstack/dualstack_test.go b/tests/e2e/dualstack/dualstack_test.go index ad75142930ab..1c1b81260f00 100644 --- a/tests/e2e/dualstack/dualstack_test.go +++ b/tests/e2e/dualstack/dualstack_test.go @@ -190,9 +190,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/embeddedmirror/embeddedmirror_test.go b/tests/e2e/embeddedmirror/embeddedmirror_test.go index 77c93bdc3846..c50923fbf80d 100644 --- a/tests/e2e/embeddedmirror/embeddedmirror_test.go +++ b/tests/e2e/embeddedmirror/embeddedmirror_test.go @@ -142,10 +142,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { r2, err := e2e.RunCmdOnNode("kubectl delete deployment my-webpage-1 my-webpage-2 my-webpage-3", serverNodeNames[0]) Expect(err).NotTo(HaveOccurred(), r2) Expect(err).NotTo(HaveOccurred()) diff --git a/tests/e2e/externalip/externalip_test.go b/tests/e2e/externalip/externalip_test.go index 79f76ffad7ee..1379a24cdeaa 100644 --- a/tests/e2e/externalip/externalip_test.go +++ b/tests/e2e/externalip/externalip_test.go @@ -160,9 +160,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/privateregistry/privateregistry_test.go b/tests/e2e/privateregistry/privateregistry_test.go index d00629131aa6..508070087f8c 100644 --- a/tests/e2e/privateregistry/privateregistry_test.go +++ b/tests/e2e/privateregistry/privateregistry_test.go @@ -146,10 +146,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { r1, err := e2e.RunCmdOnNode("docker rm -f registry", serverNodeNames[0]) Expect(err).NotTo(HaveOccurred(), r1) r2, err := e2e.RunCmdOnNode("kubectl delete deployment my-webpage", serverNodeNames[0]) diff --git a/tests/e2e/rotateca/rotateca_test.go b/tests/e2e/rotateca/rotateca_test.go index eae278db7e14..87d6aef70840 100644 --- a/tests/e2e/rotateca/rotateca_test.go +++ b/tests/e2e/rotateca/rotateca_test.go @@ -133,9 +133,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/s3/s3_test.go b/tests/e2e/s3/s3_test.go index 4d7b493ac1da..4da6089d2f04 100644 --- a/tests/e2e/s3/s3_test.go +++ b/tests/e2e/s3/s3_test.go @@ -130,8 +130,19 @@ var _ = Describe("Verify Create", Ordered, func() { // https://github.com/rancher/rke2/issues/3714 // Once fixed, ensure that the snapshots list are actually reduced to 2 It("prunes s3 snapshots", func() { - _, err := e2e.RunCmdOnNode("k3s etcd-snapshot prune --snapshot-retention 2", serverNodeNames[0]) + _, err := e2e.RunCmdOnNode("k3s etcd-snapshot save", serverNodeNames[0]) Expect(err).NotTo(HaveOccurred()) + _, err = e2e.RunCmdOnNode("k3s etcd-snapshot save", serverNodeNames[0]) + Expect(err).NotTo(HaveOccurred()) + res, err := e2e.RunCmdOnNode("k3s etcd-snapshot prune --snapshot-retention 2", serverNodeNames[0]) + Expect(err).NotTo(HaveOccurred()) + Expect(res).To(ContainSubstring("Reconciliation of ETCDSnapshotFile resources complete")) + + _, err = e2e.RunCmdOnNode("k3s etcd-snapshot ls|grep 'on-demand'|wc -l>count", serverNodeNames[0]) + Expect(err).NotTo(HaveOccurred()) + res, err = e2e.RunCmdOnNode("grep '^[4]$' ./count", serverNodeNames[0]) + Expect(err).NotTo(HaveOccurred()) + Expect(strings.TrimSpace(res)).To(Equal("4")) }) }) }) @@ -142,10 +153,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/secretsencryption/secretsencryption_test.go b/tests/e2e/secretsencryption/secretsencryption_test.go index 95edd8fca487..fb8c6e4c9160 100644 --- a/tests/e2e/secretsencryption/secretsencryption_test.go +++ b/tests/e2e/secretsencryption/secretsencryption_test.go @@ -306,9 +306,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/snapshotrestore/snapshotrestore_test.go b/tests/e2e/snapshotrestore/snapshotrestore_test.go index d9bb6480289e..4805d6cedc18 100644 --- a/tests/e2e/snapshotrestore/snapshotrestore_test.go +++ b/tests/e2e/snapshotrestore/snapshotrestore_test.go @@ -317,9 +317,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/splitserver/splitserver_test.go b/tests/e2e/splitserver/splitserver_test.go index 7c774da90050..9fb80e91807e 100644 --- a/tests/e2e/splitserver/splitserver_test.go +++ b/tests/e2e/splitserver/splitserver_test.go @@ -229,9 +229,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/startup/startup_test.go b/tests/e2e/startup/startup_test.go index b934166e5d4e..f582214c9cf9 100644 --- a/tests/e2e/startup/startup_test.go +++ b/tests/e2e/startup/startup_test.go @@ -277,9 +277,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/tailscale/tailscale_test.go b/tests/e2e/tailscale/tailscale_test.go index 8e469058aed5..1241f35eae0b 100644 --- a/tests/e2e/tailscale/tailscale_test.go +++ b/tests/e2e/tailscale/tailscale_test.go @@ -117,9 +117,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/token/token_test.go b/tests/e2e/token/token_test.go index 59cedbedc30d..58d3ad3f52d8 100644 --- a/tests/e2e/token/token_test.go +++ b/tests/e2e/token/token_test.go @@ -201,9 +201,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/upgradecluster/upgradecluster_test.go b/tests/e2e/upgradecluster/upgradecluster_test.go index 9ac7bf2f5acb..13c316f69738 100644 --- a/tests/e2e/upgradecluster/upgradecluster_test.go +++ b/tests/e2e/upgradecluster/upgradecluster_test.go @@ -385,9 +385,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/validatecluster/validatecluster_test.go b/tests/e2e/validatecluster/validatecluster_test.go index c6204b2a8f68..3b91c968143d 100644 --- a/tests/e2e/validatecluster/validatecluster_test.go +++ b/tests/e2e/validatecluster/validatecluster_test.go @@ -382,9 +382,7 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - if failed && !*ci { - fmt.Println("FAILED!") - } else { + if !failed || *ci { Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) } diff --git a/tests/e2e/wasm/wasm_test.go b/tests/e2e/wasm/wasm_test.go index 832ec54bf704..01a1ed6f3b43 100644 --- a/tests/e2e/wasm/wasm_test.go +++ b/tests/e2e/wasm/wasm_test.go @@ -138,7 +138,6 @@ var _ = AfterSuite(func() { if failed && !*ci { fmt.Println("FAILED!") } else { - Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed()) Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) }