From db1a4d73e1c655c5e8c7b5fe33c08ade09ceecb1 Mon Sep 17 00:00:00 2001 From: Ryotaro Banno Date: Mon, 8 Jul 2024 05:04:05 +0000 Subject: [PATCH] fixup! implement reconciler for MantleBackupConfig --- test/e2e/backup_test.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/e2e/backup_test.go b/test/e2e/backup_test.go index 86fedd73..7e333f3e 100644 --- a/test/e2e/backup_test.go +++ b/test/e2e/backup_test.go @@ -79,14 +79,14 @@ func (test *backupTest) setupEnv() { func (test *backupTest) teardownEnv() { It("Delete the MantleBackupConfig and the MantleBackups associated with it.", func() { - mbc, err := getMBC(test.tenantNamespace1, test.mantleBackupConfigName[0]) + mbc, err := getMBC(test.tenantNamespace, test.mantleBackupConfigName[0]) if err == nil { - _, _, err := kubectl("delete", "-n", test.tenantNamespace1, "mantlebackupconfig", test.mantleBackupConfigName[0]) + _, _, err := kubectl("delete", "-n", test.tenantNamespace, "mantlebackupconfig", test.mantleBackupConfigName[0]) if err == nil { - mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace1, string(mbc.UID)) + mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace, string(mbc.UID)) if err == nil { for _, mb := range mbs { - _, _, _ = kubectl("delete", "-n", test.tenantNamespace1, "mantlebackup", mb.Name) + _, _, _ = kubectl("delete", "-n", test.tenantNamespace, "mantlebackup", mb.Name) } } } @@ -246,11 +246,11 @@ func (test *backupTest) testCase1() { func (test *backupTest) testCase2() { It("should create and rotate MantleBackups from MantleBackupConfig", func() { By("Creating MantleBackupConfig") - err := applyMantleBackupConfigTemplate(test.tenantNamespace1, test.pvcName1, test.mantleBackupConfigName[2]) + err := applyMantleBackupConfigTemplate(test.tenantNamespace, test.pvcName1, test.mantleBackupConfigName[2]) Expect(err).NotTo(HaveOccurred()) By("Waiting for a CronJob to be created") - mbc, err := getMBC(test.tenantNamespace1, test.mantleBackupConfigName[2]) + mbc, err := getMBC(test.tenantNamespace, test.mantleBackupConfigName[2]) Expect(err).NotTo(HaveOccurred()) cronJobName := "mbc-" + string(mbc.UID) Eventually(func() error { @@ -265,7 +265,7 @@ func (test *backupTest) testCase2() { By("Waiting for a MantleBackup to be created") var mb mantlev1.MantleBackup Eventually(func() error { - mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace1, string(mbc.UID)) + mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace, string(mbc.UID)) if err != nil { return err } @@ -278,7 +278,7 @@ func (test *backupTest) testCase2() { By("Waiting for MantleBackups to be rotated") Eventually(func() error { - mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace1, string(mbc.UID)) + mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace, string(mbc.UID)) if err != nil { return err } @@ -291,14 +291,14 @@ func (test *backupTest) testCase2() { It("should not delete the MantleBackups taken for a MantleBackupConfig even when the MantleBackupConfig is deleted", func() { By("Creating MantleBackupConfig") - err := applyMantleBackupConfigTemplate(test.tenantNamespace1, test.pvcName1, test.mantleBackupConfigName[4]) + err := applyMantleBackupConfigTemplate(test.tenantNamespace, test.pvcName1, test.mantleBackupConfigName[4]) Expect(err).NotTo(HaveOccurred()) - mbc, err := getMBC(test.tenantNamespace1, test.mantleBackupConfigName[4]) + mbc, err := getMBC(test.tenantNamespace, test.mantleBackupConfigName[4]) By("Waiting for a MantleBackup to be created") var mb mantlev1.MantleBackup Eventually(func() error { - mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace1, string(mbc.UID)) + mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace, string(mbc.UID)) if err != nil { return err } @@ -323,11 +323,11 @@ func (test *backupTest) testCase2() { It("should not delete a MantleBackup if it has an annotation of retainIfExpired", func() { By("Creating MantleBackupConfig") - err := applyMantleBackupConfigTemplate(test.tenantNamespace1, test.pvcName1, test.mantleBackupConfigName[1]) + err := applyMantleBackupConfigTemplate(test.tenantNamespace, test.pvcName1, test.mantleBackupConfigName[1]) Expect(err).NotTo(HaveOccurred()) By("Waiting for a CronJob to be created") - mbc, err := getMBC(test.tenantNamespace1, test.mantleBackupConfigName[1]) + mbc, err := getMBC(test.tenantNamespace, test.mantleBackupConfigName[1]) Expect(err).NotTo(HaveOccurred()) cronJobName := "mbc-" + string(mbc.UID) Eventually(func() error { @@ -338,7 +338,7 @@ func (test *backupTest) testCase2() { By("Attaching an annotation of retainIfExpired to a MantleBackup") var mb mantlev1.MantleBackup Eventually(func() error { - mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace1, string(mbc.UID)) + mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace, string(mbc.UID)) if err != nil { return err } @@ -361,7 +361,7 @@ func (test *backupTest) testCase2() { By("Checking mbs not annotated with retainIfExpired are rotated") Eventually(func() error { - mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace1, string(mbc.UID)) + mbs, err := listMantleBackupsByMBCUID(test.tenantNamespace, string(mbc.UID)) if err != nil { return err } @@ -389,11 +389,11 @@ func (test *backupTest) testCase2() { It("should re-create a CronJob associated with a MantleBackup when it's deleted by someone", func() { By("Creating MantleBackupConfig") - err := applyMantleBackupConfigTemplate(test.tenantNamespace1, test.pvcName1, test.mantleBackupConfigName[3]) + err := applyMantleBackupConfigTemplate(test.tenantNamespace, test.pvcName1, test.mantleBackupConfigName[3]) Expect(err).NotTo(HaveOccurred()) By("Waiting for a CronJob to be created") - mbc, err := getMBC(test.tenantNamespace1, test.mantleBackupConfigName[3]) + mbc, err := getMBC(test.tenantNamespace, test.mantleBackupConfigName[3]) Expect(err).NotTo(HaveOccurred()) cronJobName := "mbc-" + string(mbc.UID) Eventually(func() error {