Skip to content

git/stats: Fix race when verifying clone timings

Patrick Steinhardt requested to merge pks-git-stats-fix-racy-clone-test into master

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.

Merge request reports