Skip to content

Commit a1e68af

Browse files
committed
e2e: clean up namespaces after backup-failure tests to avoid interfering with subsequent tests
The test "should handle removal of MantleBackup in secondary k8s cluster during an incremental backup" was failing with a timeout. When the previous test (primary MantleBackup deletion scenario) finishes, a residual secondary MantleBackup is left behind in "waiting for export data" state because its primary was deleted before the upload completed. When the next test pauses RGW, the secondary reconciler gets blocked on S3 operations triggered by processing this residual MantleBackup, causing `kubectl delete --timeout=3m` issued against the current test's secondary MantleBackup to expire before finalizeSecondary could run. Delete both primary and secondary namespaces at the end of each backup-failure test via DeferCleanup, so that no residual MantleBackups remain when the next test starts. Signed-off-by: Kohya Shiozaki <kouyan120706@gmail.com>
1 parent 6fb2d62 commit a1e68af

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

test/e2e/multik8s/backup_failure_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
1414
backupName := util.GetUniqueName("mb-")
1515

1616
SetupEnvironment(namespace)
17+
DeferCleanup(func() { TearDownEnvironment(namespace) })
1718

1819
// Pause the object storage to make backups fail.
1920
PauseObjectStorage(ctx)
@@ -55,6 +56,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
5556
restoreName := util.GetUniqueName("mr-")
5657

5758
SetupEnvironment(namespace)
59+
DeferCleanup(func() { TearDownEnvironment(namespace) })
5860

5961
// Pause the object storage to make backups fail.
6062
PauseObjectStorage(ctx)
@@ -106,6 +108,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
106108
restoreName0 := util.GetUniqueName("mr-")
107109

108110
SetupEnvironment(namespace)
111+
DeferCleanup(func() { TearDownEnvironment(namespace) })
109112

110113
// Create MantleBackup M0.
111114
CreatePVC(ctx, PrimaryK8sCluster, namespace, pvcName)
@@ -158,6 +161,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
158161
restoreName1 := util.GetUniqueName("mr-")
159162

160163
SetupEnvironment(namespace)
164+
DeferCleanup(func() { TearDownEnvironment(namespace) })
161165

162166
// Create MantleBackup M0.
163167
CreatePVC(ctx, PrimaryK8sCluster, namespace, pvcName)

test/e2e/multik8s/testutil/util.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,14 @@ func SetupEnvironment(namespace string) {
486486
}).Should(Succeed())
487487
}
488488

489+
func TearDownEnvironment(namespace string) {
490+
GinkgoHelper()
491+
_, _, err := Kubectl(PrimaryK8sCluster, nil, "delete", "namespace", namespace, "--ignore-not-found")
492+
Expect(err).NotTo(HaveOccurred())
493+
_, _, err = Kubectl(SecondaryK8sCluster, nil, "delete", "namespace", namespace, "--ignore-not-found")
494+
Expect(err).NotTo(HaveOccurred())
495+
}
496+
489497
func CreatePod(cluster int, namespace, podName, pvcName string) {
490498
GinkgoHelper()
491499
err := applyPodMountVolumeTemplate(cluster, namespace, podName, pvcName)

0 commit comments

Comments
 (0)