Repository navigation
Fix flaky tests on Windows and slow runners - #572
Merged
Merged
Conversation
The job store tests left their jobs running after the test, and on Windows the test's directories could not be removed while a job was still writing to them. JobStore.Wait now waits for jobs to return, and the tests cancel their jobs and wait for them.
Shutdown cancelled the eviction, retention, reclaim, backfill and stats loops but closed storage and the database without waiting for them, and the stats loop never stopped. A pass still running kept the database open, which on Windows left proxy.db locked after a server test. Shutdown now waits up to 30 seconds for them, and for mirror jobs.
A response that ended early for another reason than the size limit was passed on as complete. TestRelayStopsAtLimit failed that way in CI. The test upstream now reads the request body as a git server does, and the test prints the relay's log when it fails.
TestSlowFetchAfterPushIsWaitedFor relied on the ref check finishing within two seconds, which a slow Windows runner missed. The test now holds the fetch and ends RefreshWait itself. When the check and the wait end together, ensureFresh now waits for the fetch rather than picking either at random. Failing gitcache tests print the cache's log.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five tests failed now and then in CI, mostly on Windows.
TestJobStoreCreateAndGetand the other job store and mirror API tests left their mirror job running after the test, and Windows couldn't remove the temp directory while the job wrote to it.JobStore.Waitwaits for jobs, and the tests cancel theirs and wait.TestScanFetchRouteNotMountedWhenScanningDisabled:Shutdownclosed the database without waiting for the background loops it had cancelled, and the stats loop never stopped, so a pass still running keptproxy.dbopen. Shutdown now waits up to 30 seconds for them and for mirror jobs, which also keeps real shutdowns from querying a closed database.TestRelayStopsAtLimitsaw a response end after 33 KB of 4 MB without an error. The relay passed on any copy error other than the size limit as a complete response; it now cuts the connection, so git fails instead. I couldn't reproduce the early end locally. The test upstream now reads the request body as git's server does, and the test prints the relay's log if it fails again.TestSlowFetchAfterPushIsWaitedForrelied on the ref check finishing within two seconds. It now holds the fetch and ends RefreshWait through a test hook, and takes about 1.5 s instead of 4. When the check and RefreshWait end together,ensureFreshnow waits for the fetch instead of picking one at random.TestStalledFetchAfterPushServesCachedCopygot a 502 once on Windows, and the CI log doesn't show why. Failing gitcache tests now print the cache's log, so the next failure will.