Skip to content

Commit

Permalink
Make incremental backups public (#225)
Browse files Browse the repository at this point in the history
* Make incremental backups public

* Remove backup policy v1

---------

Co-authored-by: Srinivas Pothuraju <[email protected]>
  • Loading branch information
cdavid and posriniv authored Apr 19, 2024
1 parent db4d5c2 commit 90c548a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 466 deletions.
7 changes: 1 addition & 6 deletions cmd/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/yugabyte/ybm-cli/cmd/backup/policy"
"github.com/yugabyte/ybm-cli/cmd/backup/policyv2"
"github.com/yugabyte/ybm-cli/cmd/util"
ybmAuthClient "github.com/yugabyte/ybm-cli/internal/client"
Expand Down Expand Up @@ -276,11 +275,7 @@ func init() {
deleteBackupCmd.Flags().String("backup-id", "", "[REQUIRED] The backup ID.")
deleteBackupCmd.MarkFlagRequired("backup-id")
deleteBackupCmd.Flags().BoolP("force", "f", false, "Bypass the prompt for non-interactive usage")
if util.IsFeatureFlagEnabled(util.INCREMENTAL_BACKUP) {
BackupCmd.AddCommand(policyv2.PolicyCmd)
} else {
BackupCmd.AddCommand(policy.PolicyCmd)
}
BackupCmd.AddCommand(policyv2.PolicyCmd)

BackupCmd.AddCommand(describeBackupCmd)
describeBackupCmd.Flags().String("backup-id", "", "[REQUIRED] The backup ID.")
Expand Down
296 changes: 0 additions & 296 deletions cmd/backup/policy/policy.go

This file was deleted.

41 changes: 0 additions & 41 deletions cmd/backup_shedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,51 +78,13 @@ var _ = Describe("BackupSchedules", func() {
})
Context("with a valid Api token and default output table", func() {

It("should return list of backup schedules with a paused schedule", func() {
server.AppendHandlers(
ghttp.CombineHandlers(
ghttp.VerifyRequest(http.MethodGet, "/api/public/v1/accounts/340af43a-8a7c-4659-9258-4876fd6a207b/projects/78d4459c-0f45-47a5-899a-45ddf43eba6e/backup-schedules"),
ghttp.RespondWithJSONEncodedPtr(&statusCode, responseListBackupSchedules),
),
)
os.Unsetenv("YBM_FF_INCREMENTAL_BACKUP")
cmd := exec.Command(compiledCLIPath, "backup", "policy", "list", "--cluster-name", "stunning-sole")
session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())
session.Wait(2)
o := string(session.Out.Contents()[:])
expected := `Time Interval(days) Days of the Week Backup Start Time Retention Period(days) State
1 NA NA 8 PAUSED` + "\n"
Expect(o).Should(Equal(expected))

session.Kill()
})
It("should return backup schedules with cron expression with an active schedule", func() {
server.AppendHandlers(
ghttp.CombineHandlers(
ghttp.VerifyRequest(http.MethodGet, "/api/public/v1/accounts/340af43a-8a7c-4659-9258-4876fd6a207b/projects/78d4459c-0f45-47a5-899a-45ddf43eba6e/backup-schedules"),
ghttp.RespondWithJSONEncodedPtr(&statusCode, responseListCronBackupSchedules),
),
)
os.Unsetenv("YBM_FF_INCREMENTAL_BACKUP")
cmd := exec.Command(compiledCLIPath, "backup", "policy", "list", "--cluster-name", "stunning-sole")
session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())
session.Wait(2)
o := string(session.Out.Contents()[:])
expected := `Time Interval(days) Days of the Week Backup Start Time Retention Period(days) State
NA Su,We,Fr ` + getLocalTime("2 3 * * *") + ` 8 ACTIVE` + "\n"
Expect(o).Should(Equal(expected))
session.Kill()
})
It("should return list of backup schedules with a paused schedule with incremental backups", func() {
server.AppendHandlers(
ghttp.CombineHandlers(
ghttp.VerifyRequest(http.MethodGet, "/api/public/v1/accounts/340af43a-8a7c-4659-9258-4876fd6a207b/projects/78d4459c-0f45-47a5-899a-45ddf43eba6e/clusters/5f80730f-ba3f-4f7e-8c01-f8fa4c90dad8/backup-schedules"),
ghttp.RespondWithJSONEncodedPtr(&statusCode, responseListIncrementalBackupSchedules),
),
)
os.Setenv("YBM_FF_INCREMENTAL_BACKUP", "true")
cmd := exec.Command(compiledCLIPath, "backup", "policy", "list", "--cluster-name", "stunning-sole")
session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -131,7 +93,6 @@ NA Su,We,Fr ` + getLocalTime("2 3 * * *") + `
expected := `Time Interval(days) Incr. Interval(mins) Days of the Week Backup Start Time Retention Period(days) State
1 60 NA NA 8 PAUSED` + "\n"
Expect(o).Should(Equal(expected))
os.Unsetenv("YBM_FF_INCREMENTAL_BACKUP")
session.Kill()
})
It("should return backup schedules with cron expression with an active schedule with incremental backups", func() {
Expand All @@ -141,7 +102,6 @@ NA Su,We,Fr ` + getLocalTime("2 3 * * *") + `
ghttp.RespondWithJSONEncodedPtr(&statusCode, responseListIncrementalCronBackupSchedules),
),
)
os.Setenv("YBM_FF_INCREMENTAL_BACKUP", "true")
cmd := exec.Command(compiledCLIPath, "backup", "policy", "list", "--cluster-name", "stunning-sole")
session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -150,7 +110,6 @@ NA Su,We,Fr ` + getLocalTime("2 3 * * *") + `
expected := `Time Interval(days) Incr. Interval(mins) Days of the Week Backup Start Time Retention Period(days) State
NA NA Su,We,Fr ` + getLocalTime("2 3 * * *") + ` 8 ACTIVE` + "\n"
Expect(o).Should(Equal(expected))
os.Unsetenv("YBM_FF_INCREMENTAL_BACKUP")

session.Kill()
})
Expand Down
Loading

0 comments on commit 90c548a

Please sign in to comment.