@@ -7,6 +7,7 @@ package postgrescluster
7
7
import (
8
8
"context"
9
9
"testing"
10
+ "time"
10
11
11
12
"github.com/pkg/errors"
12
13
"gotest.tools/v3/assert"
@@ -561,7 +562,7 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
561
562
// Create successful restore job
562
563
restoreJob := testRestoreJob (cluster )
563
564
restoreJob .Annotations = map [string ]string {
564
- naming .PGBackRestBackupJobCompletion : backupJob .Status .CompletionTime .String ( ),
565
+ naming .PGBackRestBackupJobCompletion : backupJob .Status .CompletionTime .Format ( time . RFC3339 ),
565
566
}
566
567
err = errors .WithStack (r .setControllerReference (cluster , restoreJob ))
567
568
assert .NilError (t , err )
@@ -603,7 +604,7 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
603
604
assert .Equal (t , len (restoreJobs .Items ), 0 )
604
605
605
606
// Assert pvc was annotated
606
- assert .Equal (t , pvc .GetAnnotations ()[naming .PGBackRestBackupJobCompletion ], backupJob .Status .CompletionTime .String ( ))
607
+ assert .Equal (t , pvc .GetAnnotations ()[naming .PGBackRestBackupJobCompletion ], backupJob .Status .CompletionTime .Format ( time . RFC3339 ))
607
608
})
608
609
609
610
t .Run ("SnapshotsEnabledFailedRestoreExists" , func (t * testing.T ) {
@@ -646,7 +647,7 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
646
647
// Create failed restore job
647
648
restoreJob := testRestoreJob (cluster )
648
649
restoreJob .Annotations = map [string ]string {
649
- naming .PGBackRestBackupJobCompletion : backupJob .Status .CompletionTime .String ( ),
650
+ naming .PGBackRestBackupJobCompletion : backupJob .Status .CompletionTime .Format ( time . RFC3339 ),
650
651
}
651
652
err = errors .WithStack (r .setControllerReference (cluster , restoreJob ))
652
653
assert .NilError (t , err )
@@ -758,7 +759,7 @@ func TestDedicatedSnapshotVolumeRestore(t *testing.T) {
758
759
assert .NilError (t , err )
759
760
assert .Equal (t , len (jobs .Items ), 1 )
760
761
assert .Equal (t , jobs .Items [0 ].Annotations [naming .PGBackRestBackupJobCompletion ],
761
- backupJob .Status .CompletionTime .String ( ))
762
+ backupJob .Status .CompletionTime .Format ( time . RFC3339 ))
762
763
}
763
764
764
765
func TestGenerateSnapshotOfDedicatedSnapshotVolume (t * testing.T ) {
0 commit comments