Hold runMu in internal/cli tests that log outside a CLI run (closes #210)
check / check (push) Waiting to run

A CLI run under runMu points the process-global logger at its own
buffers, so a line another test logged outside runMu could land in that
run's output. TestCheckQuietShowsFailedFiles caught one: a "loaded
manifest" line in the stderr of a passing check -q run.

The test helpers that scan or load a manifest now hold runMu
themselves, and so do the remaining direct loads and scans, the
recordEntry call and the retrying download. Two dotfile tests use
manifestPaths instead of loading the manifest themselves.

Judgement call: a downloadFile call that gets its answer on the first
request does not log, so those calls are left as they are.

Model: opus-5-5
This commit is contained in:
2026-10-13 18:39:41 +00:00
parent 24496880c5
commit 06447668f1
5 changed files with 72 additions and 25 deletions
+5
View File
@@ -20,6 +20,11 @@ const testCmdExport = "export"
func buildTestManifest(t *testing.T, files map[string][]byte) []byte {
t.Helper()
// The scan logs to the process-global logger, so serialize with the
// CLI runs.
runMu.Lock()
defer runMu.Unlock()
sourceFs := afero.NewMemMapFs()
for path, content := range files {
require.NoError(t, sourceFs.MkdirAll("/", 0o755))