test(server): fixed flaky TestSnapshotCounters test (#1734)

This commit is contained in:
Jarek Kowalski authored and GitHub committed 2022-02-06 21:12:49 -08:00
1 parent 4fb473dc77
commit 04f70f74f3
1 file changed
+8 -2
+8 -2
View File
@@ -68,11 +68,17 @@ func TestSnapshotCounters(t *testing.T) {
require.NoError(t, err)
// wait until new task for the upload is created
deadline := clock.Now().Add(10 * time.Second)
for mustGetLatestTask(t, cli).TaskID == et.TaskID && clock.Now().Before(deadline) {
deadline := clock.Now().Add(30 * time.Second)
latest := mustGetLatestTask(t, cli)
for latest.TaskID == et.TaskID && clock.Now().Before(deadline) {
time.Sleep(100 * time.Microsecond)
latest = mustGetLatestTask(t, cli)
}
require.NotEqual(t, latest.TaskID, et.TaskID)
ut := waitForTask(t, cli, mustGetLatestTask(t, cli).TaskID, 15*time.Second)
t.Logf("got latest task: %v", ut)