Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2020-09-15 13:47:05 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2020-09-15 13:56:38 +0300
commita9ad86db4eda437fe816df1d2f2038185a5e3a8d (patch)
tree22963b8788e60cdf74ef1b58703a5d4ec13490ec
parentb8e4eb7128808a874cb34bc529330b8cd080ccdc (diff)
praefect: Add more tolerance in racy error threshold tests
As the error threshold checks function asynchronously, we're sleeping in the tests which exercises that code. Naturally, CI still manages to be slow enought to loose the race. Improve the situation by increasing the amount of time waited from 10ms to 50ms. To not penalize fast machines, we now sleep in a loop for 1ms steps until we see the expected error.
-rw-r--r--internal/praefect/server_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go
index 0dae99082..6e5f7704b 100644
--- a/internal/praefect/server_test.go
+++ b/internal/praefect/server_test.go
@@ -1012,9 +1012,12 @@ func TestErrorThreshold(t *testing.T) {
require.Equal(t, expectedErr, err)
}
- time.Sleep(10 * time.Millisecond)
-
- _, err = nodeMgr.GetShard("default")
+ for i := 0; i < 50; i++ {
+ if _, err = nodeMgr.GetShard("default"); err != nil {
+ break
+ }
+ time.Sleep(1 * time.Millisecond)
+ }
require.Equal(t, nodes.ErrPrimaryNotHealthy, err)
})
}