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>2023-02-16 14:31:25 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-02-16 14:34:47 +0300
commit5df4f36abed9e976a9a3bca21fdf2d0c60d284ba (patch)
treed4700474fd4b2155873044e6a21ac5660d576f22
parentf223d8cbcb6319356cb9f746252b15e541695d2f (diff)
git/stats: Fix race when verifying clone timings
One of the things that the git/stats package does is to record timings for various different steps in a fetch. As we cannot tell how long it takes for each of these steps to complete the best we can do in the test is to verify that timings are in the expected order. The check we have for this is flaky though as it may happen that two packets are observed in the same instant, but we test for times being in strictly-increasing order: === FAIL: internal/git/stats TestClone (0.50s) http_clone_test.go:73: Error Trace: /builds/gitlab-org/gitaly/internal/git/stats/http_clone_test.go:73 Error: Should be true Test: TestClone Messages: post: expect time to receive first progress message (134.178921ms) to be greater than previous value 134.178921ms Fix this flake by also allowing for the same time stamp.
-rw-r--r--internal/git/stats/http_clone_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/git/stats/http_clone_test.go b/internal/git/stats/http_clone_test.go
index 11a7f768d..ea580f826 100644
--- a/internal/git/stats/http_clone_test.go
+++ b/internal/git/stats/http_clone_test.go
@@ -46,7 +46,7 @@ func TestClone(t *testing.T) {
{"time to first packet", clone.ReferenceDiscovery.FirstGitPacket()},
{"time to receive response body", clone.ReferenceDiscovery.ResponseBody()},
} {
- require.True(t, m.value > previousValue, "get: expect %s (%v) to be greater than previous value %v", m.desc, m.value, previousValue)
+ require.GreaterOrEqual(t, m.value, previousValue, "get: expect %s (%v) to be greater than previous value %v", m.desc, m.value, previousValue)
previousValue = m.value
}
@@ -70,7 +70,7 @@ func TestClone(t *testing.T) {
{"time to receive first pack message", clone.FetchPack.BandFirstPacket("pack")},
{"time to receive response body", clone.FetchPack.ResponseBody()},
} {
- require.True(t, m.value > previousValue, "post: expect %s (%v) to be greater than previous value %v", m.desc, m.value, previousValue)
+ require.GreaterOrEqual(t, m.value, previousValue, "post: expect %s (%v) to be greater than previous value %v", m.desc, m.value, previousValue)
previousValue = m.value
}
}