Skip to content

Commit 6e5cca4

Browse files
do not use RFC3339 because with zulu time it only adds a Z and no timeshift (#601)
* zalando does not support RFC3339 * do not export this contant
1 parent 27e4ec6 commit 6e5cca4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

api/v1/postgres_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ const (
102102
PostgresConfigReplicationUsername = "standby"
103103
PostgresConfigAuditorUsername = "auditor"
104104
PostgresConfigMonitoringUsername = "monitoring"
105+
106+
zalando_timestamp_format = "2006-01-02T15:04:05-07:00"
105107
)
106108

107109
var (
@@ -762,7 +764,7 @@ func (p *Postgres) ToUnstructuredZalandoPostgresql(z *zalando.Postgresql, c *cor
762764
// 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.
763765
if p.Spec.PostgresRestore.Timestamp == "" {
764766
// e.g. 2021-12-07T15:28:00+01:00
765-
p.Spec.PostgresRestore.Timestamp = time.Now().Format(time.RFC3339)
767+
p.Spec.PostgresRestore.Timestamp = time.Now().Format(zalando_timestamp_format)
766768
}
767769

768770
z.Spec.Clone = &zalando.CloneDescription{

api/v1/postgres_types_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func TestPostgresRestoreTimestamp_ToUnstructuredZalandoPostgresql(t *testing.T)
257257
Description: "description",
258258
},
259259
},
260-
want: time.Now().Format(time.RFC3339), // I know this is not perfect, let's just hope we always finish within the same second...
260+
want: time.Now().Format(zalando_timestamp_format), // I know this is not perfect, let's just hope we always finish within the same second...
261261
wantErr: false,
262262
},
263263
{
@@ -283,7 +283,7 @@ func TestPostgresRestoreTimestamp_ToUnstructuredZalandoPostgresql(t *testing.T)
283283
Description: "description",
284284
},
285285
},
286-
want: time.Now().Format(time.RFC3339), // I know this is not perfect, let's just hope we always finish within the same second...
286+
want: time.Now().Format(zalando_timestamp_format), // I know this is not perfect, let's just hope we always finish within the same second...
287287
wantErr: false,
288288
},
289289
{

0 commit comments

Comments
 (0)