Skip to content

Commit 3fbb1a9

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 3fbb1a9

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
@@ -46,6 +46,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
4646
WaitTemporaryJobsDeleted(ctx, primaryMB, secondaryMB)
4747
WaitTemporaryPVCsDeleted(ctx, primaryMB, secondaryMB)
4848
WaitTemporarySecondaryPVsDeleted(ctx, secondaryMB)
49+
CleanupMantleBackups(namespace)
4950
})
5051

5152
It("should handle removal of MantleBackup in secondary k8s cluster during a full backup", func(ctx SpecContext) {
@@ -95,6 +96,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
9596
Expect(err).NotTo(HaveOccurred())
9697
WaitTemporaryResourcesDeleted(ctx, primaryMB, secondaryMB0)
9798
WaitTemporaryResourcesDeleted(ctx, primaryMB, secondaryMB1)
99+
CleanupMantleBackups(namespace)
98100
})
99101

100102
It("should handle removal of MantleBackup in primary k8s cluster during an incremental backup",
@@ -146,6 +148,7 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
146148
WaitTemporaryJobsDeleted(ctx, primaryMB, secondaryMB)
147149
WaitTemporaryPVCsDeleted(ctx, primaryMB, secondaryMB)
148150
WaitTemporarySecondaryPVsDeleted(ctx, secondaryMB)
151+
CleanupMantleBackups(namespace)
149152
})
150153

151154
It("should handle removal of MantleBackup in secondary k8s cluster during an incremental backup",
@@ -206,5 +209,6 @@ var _ = Describe("backup failure", Label("backup-failure"), func() {
206209
Expect(err).NotTo(HaveOccurred())
207210
WaitTemporaryResourcesDeleted(ctx, primaryMB1, secondaryMB10)
208211
WaitTemporaryResourcesDeleted(ctx, primaryMB1, secondaryMB11)
212+
CleanupMantleBackups(namespace)
209213
})
210214
})

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)