diff --git a/api/v1/postgres_types.go b/api/v1/postgres_types.go index 328ef27a..212a1c8c 100644 --- a/api/v1/postgres_types.go +++ b/api/v1/postgres_types.go @@ -102,6 +102,8 @@ const ( PostgresConfigReplicationUsername = "standby" PostgresConfigAuditorUsername = "auditor" PostgresConfigMonitoringUsername = "monitoring" + + zalando_timestamp_format = "2006-01-02T15:04:05-07:00" ) var ( @@ -762,7 +764,7 @@ func (p *Postgres) ToUnstructuredZalandoPostgresql(z *zalando.Postgresql, c *cor // make sure there is always a value set. The operator will fall back to CLONE_WITH_BASEBACKUP, which assumes the source db's credentials are existing within the same namespace, which is not the case with the postgreslet. if p.Spec.PostgresRestore.Timestamp == "" { // e.g. 2021-12-07T15:28:00+01:00 - p.Spec.PostgresRestore.Timestamp = time.Now().Format(time.RFC3339) + p.Spec.PostgresRestore.Timestamp = time.Now().Format(zalando_timestamp_format) } z.Spec.Clone = &zalando.CloneDescription{ diff --git a/api/v1/postgres_types_test.go b/api/v1/postgres_types_test.go index cc68c50e..ba3a92b3 100644 --- a/api/v1/postgres_types_test.go +++ b/api/v1/postgres_types_test.go @@ -257,7 +257,7 @@ func TestPostgresRestoreTimestamp_ToUnstructuredZalandoPostgresql(t *testing.T) Description: "description", }, }, - want: time.Now().Format(time.RFC3339), // I know this is not perfect, let's just hope we always finish within the same second... + want: time.Now().Format(zalando_timestamp_format), // I know this is not perfect, let's just hope we always finish within the same second... wantErr: false, }, { @@ -283,7 +283,7 @@ func TestPostgresRestoreTimestamp_ToUnstructuredZalandoPostgresql(t *testing.T) Description: "description", }, }, - want: time.Now().Format(time.RFC3339), // I know this is not perfect, let's just hope we always finish within the same second... + want: time.Now().Format(zalando_timestamp_format), // I know this is not perfect, let's just hope we always finish within the same second... wantErr: false, }, {