Skip to content

Commit 1b9d58d

Browse files
committed
test(e2e): delete MantleBackups 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. Add CleanupMantleBackups to delete all MantleBackups on both clusters 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 1b9d58d

2 files changed

Lines changed: 14 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
@@ -13,6 +13,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
1313
pvcName := util.GetUniqueName("pvc-")
1414
backupName := util.GetUniqueName("mb-")
1515

16+
DeferCleanup(func() { CleanupMantleBackups(namespace) })
1617
SetupEnvironment(namespace)
1718

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

58+
DeferCleanup(func() { CleanupMantleBackups(namespace) })
5759
SetupEnvironment(namespace)
5860

5961
// Pause the object storage to make backups fail.
@@ -105,6 +107,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
105107
backupName1 := util.GetUniqueName("mb-")
106108
restoreName0 := util.GetUniqueName("mr-")
107109

110+
DeferCleanup(func() { CleanupMantleBackups(namespace) })
108111
SetupEnvironment(namespace)
109112

110113
// Create MantleBackup M0.
@@ -157,6 +160,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
157160
restoreName0 := util.GetUniqueName("mr-")
158161
restoreName1 := util.GetUniqueName("mr-")
159162

163+
DeferCleanup(func() { CleanupMantleBackups(namespace) })
160164
SetupEnvironment(namespace)
161165

162166
// Create MantleBackup M0.

test/e2e/multik8s/testutil/util.go

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

489+
func CleanupMantleBackups(namespace string) {
490+
GinkgoHelper()
491+
_, _, err := Kubectl(PrimaryK8sCluster, nil,
492+
"delete", "mantlebackup", "--all", "-n", namespace, "--timeout=5m", "--ignore-not-found")
493+
Expect(err).NotTo(HaveOccurred())
494+
_, _, err = Kubectl(SecondaryK8sCluster, nil,
495+
"delete", "mantlebackup", "--all", "-n", namespace, "--timeout=5m", "--ignore-not-found")
496+
Expect(err).NotTo(HaveOccurred())
497+
}
498+
489499
func CreatePod(cluster int, namespace, podName, pvcName string) {
490500
GinkgoHelper()
491501
err := applyPodMountVolumeTemplate(cluster, namespace, podName, pvcName)

0 commit comments

Comments
 (0)