Skip to content

Commit 91bb2f4

Browse files
authored
Added additional e2e tests for scheduler
Added a test for the scheduler that does not use the `--selector` flag. This will catch if errors occur when creating a schedule via the cluster name.
1 parent ea2514c commit 91bb2f4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

testing/pgo_cli/cluster_backup_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,33 @@ func TestClusterBackup(t *testing.T) {
113113
require.NoError(t, err)
114114
before := strings.Count(output, "full backup")
115115

116+
more := func() bool {
117+
output, err := pgo("show", "backup", cluster(), "-n", namespace()).Exec(t)
118+
require.NoError(t, err)
119+
return strings.Count(output, "full backup") > before
120+
}
121+
requireWaitFor(t, more, 75*time.Second, time.Second,
122+
"timeout waiting for backup to execute on %q in %q", cluster(), namespace())
123+
})
124+
t.Run("create backup noselector", func(t *testing.T) {
125+
output, err := pgo("create", "schedule", cluster(), "-n", namespace(),
126+
"--schedule-type=pgbackrest", "--schedule=* * * * *", "--pgbackrest-backup-type=full",
127+
).Exec(t)
128+
defer teardownSchedule(t, namespace(), cluster()+"-pgbackrest-full")
129+
require.NoError(t, err)
130+
require.Contains(t, output, "created")
131+
132+
output, err = pgo("show", "schedule", cluster(), "-n", namespace()).Exec(t)
133+
require.NoError(t, err)
134+
require.Contains(t, output, "pgbackrest-full")
135+
136+
requireClusterReady(t, namespace(), cluster(), time.Minute)
137+
requireStanzaExists(t, namespace(), cluster(), 2*time.Minute)
138+
139+
output, err = pgo("show", "backup", cluster(), "-n", namespace()).Exec(t)
140+
require.NoError(t, err)
141+
before := strings.Count(output, "full backup")
142+
116143
more := func() bool {
117144
output, err := pgo("show", "backup", cluster(), "-n", namespace()).Exec(t)
118145
require.NoError(t, err)

0 commit comments

Comments
 (0)