Skip to content

Commit

Permalink
fixup! implement reconciler for MantleBackupConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ushitora-anqou committed Jul 8, 2024
1 parent e6bb925 commit db1a4d7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions test/e2e/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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])

Check failure on line 296 in test/e2e/backup_test.go

View workflow job for this annotation

GitHub Actions / build

ineffectual assignment to err (ineffassign)

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
}
Expand All @@ -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 {
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit db1a4d7

Please sign in to comment.