Skip to content

Commit 72a2bd8

Browse files
pranavbansalpranavbansal
authored andcommitted
Added tests
1 parent fac7b69 commit 72a2bd8

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

cmd/backup_shedule_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ var _ = Describe("BackupSchedules", func() {
9090
Expect(err).NotTo(HaveOccurred())
9191
session.Wait(2)
9292
o := string(session.Out.Contents()[:])
93-
expected := `Time Interval(days) Incr. Interval(mins) Days of the Week Backup Start Time Retention Period(days) State
94-
1 60 NA NA 8 PAUSED` + "\n"
93+
expected := `Time Interval(days) Incr. Interval(mins) Days of the Week Backup Start Time Retention Period(days) Roles & Grants State
94+
1 60 NA NA 8 Not Included PAUSED` + "\n"
9595
Expect(o).Should(Equal(expected))
9696
session.Kill()
9797
})
@@ -107,8 +107,8 @@ var _ = Describe("BackupSchedules", func() {
107107
Expect(err).NotTo(HaveOccurred())
108108
session.Wait(2)
109109
o := string(session.Out.Contents()[:])
110-
expected := `Time Interval(days) Incr. Interval(mins) Days of the Week Backup Start Time Retention Period(days) State
111-
NA NA Su,We,Fr ` + getLocalTime("2 3 * * *") + ` 8 ACTIVE` + "\n"
110+
expected := `Time Interval(days) Incr. Interval(mins) Days of the Week Backup Start Time Retention Period(days) Roles & Grants State
111+
NA NA Su,We,Fr ` + getLocalTime("2 3 * * *") + ` 8 Included ACTIVE` + "\n"
112112
Expect(o).Should(Equal(expected))
113113

114114
session.Kill()

cmd/backup_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ var _ = Describe("Backup", func() {
7070
session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
7171
Expect(err).NotTo(HaveOccurred())
7272
session.Wait(2)
73-
Expect(session.Out).Should(gbytes.Say(fmt.Sprintf(`ID Created On Inc Expire On Clusters State Type
74-
c7742a97-cee0-449d-9c7c-4b934d9cf940 %s 🍕 %s mirthful-mole ✅ 🧑
75-
faaca956-b542-49ee-92a8-9f1e138d1311 %s 🟡 %s mirthful-mole ✅ 🧑`, formatter.FormatDate("2024-03-05T03:33:23.532Z"), formatter.FormatDateAndAddDays("2024-03-05T03:33:23.532Z", 8), formatter.FormatDate("2024-03-04T20:28:32.982Z"), formatter.FormatDateAndAddDays("2024-03-04T20:28:32.982Z", 1))))
73+
Expect(session.Out).Should(gbytes.Say(fmt.Sprintf(`ID Created On Inc Expire On Clusters State Type Roles & Grants
74+
c7742a97-cee0-449d-9c7c-4b934d9cf940 %s 🍕 %s mirthful-mole ✅ 🧑 Included
75+
faaca956-b542-49ee-92a8-9f1e138d1311 %s 🟡 %s mirthful-mole ✅ 🧑 Not Included`, formatter.FormatDate("2024-03-05T03:33:23.532Z"), formatter.FormatDateAndAddDays("2024-03-05T03:33:23.532Z", 8), formatter.FormatDate("2024-03-04T20:28:32.982Z"), formatter.FormatDateAndAddDays("2024-03-04T20:28:32.982Z", 1))))
7676
session.Kill()
7777
})
7878

@@ -94,8 +94,8 @@ faaca956-b542-49ee-92a8-9f1e138d1311 %s 🟡 %s mirthful-mole ✅
9494
ID Created On Inc Clusters State
9595
5574d58f-68f1-4762-baa1-c2421cdb38b0 %s 🟡 mirthful-mole ✅
9696
97-
Type Size(bytes) Expire On Duration
98-
🧑 1176035 %s 2 mins
97+
Type Size(bytes) Expire On Duration Roles & Grants
98+
🧑 1176035 %s 2 mins Included
9999
100100
101101
Databases/Keyspaces

cmd/test/fixtures/backup.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"cluster_id": "d6954ca7-fc4f-4454-9ce2-8c2e10ed9deb",
55
"retention_period_in_days": 1,
66
"backup_type": "FULL",
7-
"description": null
7+
"description": null,
8+
"use_roles": true
89
},
910
"info": {
1011
"id": "5574d58f-68f1-4762-baa1-c2421cdb38b0",

cmd/test/fixtures/backups.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"cluster_id": "d6954ca7-fc4f-4454-9ce2-8c2e10ed9deb",
66
"retention_period_in_days": 8,
77
"backup_type": "INCREMENTAL",
8-
"description": "Backup of the cluster XYZ"
8+
"description": "Backup of the cluster XYZ",
9+
"use_roles": true
910
},
1011
"info": {
1112
"id": "c7742a97-cee0-449d-9c7c-4b934d9cf940",
@@ -41,7 +42,8 @@
4142
"cluster_id": "d6954ca7-fc4f-4454-9ce2-8c2e10ed9deb",
4243
"retention_period_in_days": 1,
4344
"backup_type": "FULL",
44-
"description": null
45+
"description": null,
46+
"use_roles": false
4547
},
4648
"info": {
4749
"id": "faaca956-b542-49ee-92a8-9f1e138d1311",

cmd/test/fixtures/list-backup-schedules-cron-incremental.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"time_interval_in_days": 0,
77
"cron_expression": "2 3 * * 0,3,5",
88
"retention_period_in_days": 8,
9-
"state": "ACTIVE"
9+
"state": "ACTIVE",
10+
"use_roles": true
1011
},
1112
"info": {
1213
"id": "c55f06da-b6ea-44c6-a37c-b8a76d6922e4",

cmd/test/fixtures/list-backup-schedules-incremental.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"cron_expression": null,
88
"retention_period_in_days": 8,
99
"incremental_interval_in_minutes": 60,
10-
"state": "PAUSED"
10+
"state": "PAUSED",
11+
"use_roles": false
1112
},
1213
"info": {
1314
"id": "c55f06da-b6ea-44c6-a37c-b8a76d6922e4",

0 commit comments

Comments
 (0)