Skip to content

reposource: Prevent race on mocking cloneURLResolvers

Warren Gifford requested to merge flakey-test into master

Created by: keegancsmith

Test_customCloneURLToRepoName would fail sometimes, since conf.Watch in init would race with the test for setting cloneURLResolvers. Since cloneURLResolvers is only ever read from one function, we move the conf.Watch logic to that function, and protect it with a sync.Once.

This test may be better written to mock the config, or adjusting the logic to not depend on global state. But that is a larger change to make.

An example build failure is https://buildkite.com/sourcegraph/sourcegraph/builds/25536#d5c1a3c1-1c28-42ca-9454-fa0acc9f9a34

Merge request reports

Loading