satellite/satellitedb: Fix GE flaky test

Fix an issue due to copy-paste problem that made that the Graceful Exit
test to be flaky.

The test uses a time created at the beginning of the test for avoiding
to get undeterministic time differences due to the fact of the response
time variation by the DB queries, however some part of the test were
using a current time rather than this base time, so they have been
addressed.

Change-Id: I4786f06209e041269875c07798a44c2850478438
This commit is contained in:
Ivan Fraixedes 2021-02-02 13:24:42 +01:00
parent d93944c57b
commit cc0d88f9c3
No known key found for this signature in database
GPG Key ID: 042B474597F96DB7

View File

@ -73,9 +73,9 @@ func TestGracefulExit_DeleteAllFinishedTransferQueueItems(t *testing.T) {
nodeFailed2 := planet.StorageNodes[5]
_, err = cache.UpdateExitStatus(ctx, &overlay.ExitStatusRequest{
NodeID: nodeFailed2.ID(),
ExitInitiatedAt: time.Now().Add(-time.Hour),
ExitLoopCompletedAt: time.Now().Add(-17 * time.Minute),
ExitFinishedAt: time.Now().Add(-15 * time.Minute),
ExitInitiatedAt: currentTime.Add(-time.Hour),
ExitLoopCompletedAt: currentTime.Add(-17 * time.Minute),
ExitFinishedAt: currentTime.Add(-15 * time.Minute),
ExitSuccess: true,
})
require.NoError(t, err)
@ -83,9 +83,9 @@ func TestGracefulExit_DeleteAllFinishedTransferQueueItems(t *testing.T) {
nodeWithoutItems := planet.StorageNodes[6]
_, err = cache.UpdateExitStatus(ctx, &overlay.ExitStatusRequest{
NodeID: nodeWithoutItems.ID(),
ExitInitiatedAt: time.Now().Add(-time.Hour),
ExitLoopCompletedAt: time.Now().Add(-35 * time.Minute),
ExitFinishedAt: time.Now().Add(-32 * time.Minute),
ExitInitiatedAt: currentTime.Add(-time.Hour),
ExitLoopCompletedAt: currentTime.Add(-35 * time.Minute),
ExitFinishedAt: currentTime.Add(-32 * time.Minute),
ExitSuccess: false,
})
require.NoError(t, err)