mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
test(postgres): check the stored phase of a backup job per cnpg Backup phase
The phase test read the BackupJob it passed to the reconciler, which holds the phase in memory whether or not the status write happened. A completed Backup could then leave the stored BackupJob Running, so the Plan would never see the run finish, and no test in the package noticed. Assisted-by: LLM Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
This commit is contained in:
1 parent
93c3ee62c4
commit
7efe33e87d
1 file changed
+7
@@ -2421,6 +2421,13 @@ func TestReconcileCNPG_BackupPhaseOutcome(t *testing.T) {
|
||||
if j.Status.Phase != tc.wantPhase {
|
||||
t.Fatalf("BackupJob phase = %q (%s), want %q", j.Status.Phase, j.Status.Message, tc.wantPhase)
|
||||
}
|
||||
stored := &backupsv1alpha1.BackupJob{}
|
||||
if err := c.Get(context.Background(), client.ObjectKeyFromObject(job), stored); err != nil {
|
||||
t.Fatalf("get BackupJob after reconcile: %v", err)
|
||||
}
|
||||
if stored.Status.Phase != tc.wantPhase {
|
||||
t.Fatalf("stored BackupJob phase = %q, want %q", stored.Status.Phase, tc.wantPhase)
|
||||
}
|
||||
|
||||
message := j.Status.Message
|
||||
if tc.wantPhase == backupsv1alpha1.BackupJobPhaseRunning {
|
||||
|
||||
Reference in new issue
Block a user