From 5e7f3a48175ba44508d20ed8d97ea5cc21d0b5d4 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Wed, 23 Feb 2022 19:00:08 +0100 Subject: [PATCH] day after tomorrow --- pkg/cluster/sync_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cluster/sync_test.go b/pkg/cluster/sync_test.go index 70a5cf82d..226555a66 100644 --- a/pkg/cluster/sync_test.go +++ b/pkg/cluster/sync_test.go @@ -319,7 +319,7 @@ func TestUpdateSecret(t *testing.T) { // initialize rotation with current time cluster.syncSecrets() - tomorrow := time.Now().AddDate(0, 0, 2) + dayAfterTomorrow := time.Now().AddDate(0, 0, 2) for username := range cluster.Spec.Users { pgUser := cluster.pgUsers[username] @@ -330,7 +330,7 @@ func TestUpdateSecret(t *testing.T) { secretPassword := string(secret.Data["password"]) // now update the secret setting a next rotation date (tomorrow + interval) - cluster.updateSecret(username, secret, &rotationUsers, &retentionUsers, tomorrow) + cluster.updateSecret(username, secret, &rotationUsers, &retentionUsers, dayAfterTomorrow) updatedSecret, err := cluster.KubeClient.Secrets(namespace).Get(context.TODO(), secretTemplate.Format("username", username, "cluster", clusterName), metav1.GetOptions{}) assert.NoError(t, err) @@ -342,7 +342,7 @@ func TestUpdateSecret(t *testing.T) { // check that next rotation date is tomorrow + interval, not date in secret + interval nextRotation := string(updatedSecret.Data["nextRotation"]) - _, nextRotationDate := cluster.getNextRotationDate(tomorrow) + _, nextRotationDate := cluster.getNextRotationDate(dayAfterTomorrow) if nextRotation != nextRotationDate { t.Errorf("%s: updated secret of %s does not contain correct rotation date: expected %s, got %s", testName, username, nextRotationDate, nextRotation) } @@ -354,7 +354,7 @@ func TestUpdateSecret(t *testing.T) { t.Errorf("%s: username differs in updated secret: expected %s, got %s", testName, username, secretUsername) } } else { - rotatedUsername := username + tomorrow.Format("060102") + rotatedUsername := username + dayAfterTomorrow.Format("060102") if secretUsername != rotatedUsername { t.Errorf("%s: updated secret does not contain correct username: expected %s, got %s", testName, rotatedUsername, secretUsername) }