diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2021-10-26 09:46:12 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2021-10-26 12:45:55 +0300 |
commit | bc7df325ecc85da1712ee18717b4df6f87589c01 (patch) | |
tree | cbc06931c398e60087010ea96486683d680b6a98 | |
parent | a6bb648081ee3d4d3a30f50642589f49e0db55c5 (diff) |
test: Fix flaky TestStorageCleanup_AcquireNextStorage
The verification of the value filled for the TriggeredAt
is flaky as precision of the timestamp returned from the
database is less than used in code. That is why value of
the start variable often is greater than one contained in
the TriggeredAt column. As this check is not mandatory
we just skip it and verify the value is set.
-rw-r--r-- | internal/praefect/datastore/storage_cleanup_test.go | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/internal/praefect/datastore/storage_cleanup_test.go b/internal/praefect/datastore/storage_cleanup_test.go index 4ff18a00a..94f042ac4 100644 --- a/internal/praefect/datastore/storage_cleanup_test.go +++ b/internal/praefect/datastore/storage_cleanup_test.go @@ -172,7 +172,6 @@ func TestStorageCleanup_AcquireNextStorage(t *testing.T) { storageCleanup := NewStorageCleanup(tx) require.NoError(t, storageCleanup.Populate(ctx, "vs", "g1")) - start := time.Now().UTC() _, release, err := storageCleanup.AcquireNextStorage(ctx, 0, 200*time.Millisecond) require.NoError(t, err) @@ -180,7 +179,6 @@ func TestStorageCleanup_AcquireNextStorage(t *testing.T) { check1 := getAllStoragesCleanup(t, ctx, tx) require.Len(t, check1, 1) require.True(t, check1[0].TriggeredAt.Valid) - require.Truef(t, check1[0].TriggeredAt.Time.After(start), "%s is not after %s", check1[0].TriggeredAt, start) // Check the goroutine running in the background updates triggered_at column periodically. time.Sleep(time.Second) |