From 6b25f4385337fdb9dbf08cbfc28a52e6fb9b3742 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Tue, 5 May 2020 19:13:57 -0500 Subject: [PATCH] archiver: tests: simplify a bit further We don't need to risk failure and use time.ParseDuration to get 2 * time.Second. else if isn't really necessary if the conditions are simple enough and lead to the same result. --- services/archiver/archiver_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/services/archiver/archiver_test.go b/services/archiver/archiver_test.go index ee5904ef0b..5b38cb55e9 100644 --- a/services/archiver/archiver_test.go +++ b/services/archiver/archiver_test.go @@ -137,8 +137,7 @@ func TestArchive_Basic(t *testing.T) { ArchiveRepository(zipReq) // Sleep two seconds to make sure the queue doesn't change. - twoSeconds, _ := time.ParseDuration("2s") - time.Sleep(twoSeconds) + time.Sleep(2 * time.Second) assert.Equal(t, 3, len(archiveInProgress)) // Release them all, they'll then stall at the archiveQueueReleaseCond while @@ -150,9 +149,7 @@ func TestArchive_Basic(t *testing.T) { // 8 second timeout for them all to complete. timeout := time.Now().Add(8 * time.Second) for { - if allComplete(inFlight) { - break - } else if time.Now().After(timeout) { + if allComplete(inFlight) || time.Now().After(timeout) { break } }