go test suite reaches the real config env: gitsync fetches + smart-defaults parse fire during unit tests #1128

Closed
opened 2026-07-12 06:20:01 +00:00 by coilysiren · 0 comments
Owner

Running go test ./... in a shell with WARD_CONFIG_REF set makes test binaries resolve the REAL config source: the log shows ward: config-bundle gitsync: refresh https://forgejo.coilysiren.me/... plus live fetch output and deprecation warnings mid-suite (observed 2026-07-11, Windows host). A unit-test run should never touch the network or the operator config; a flaky Forgejo or an expired credential can redden unrelated tests, and tests can poison the real config-bundle cache.

Wrap the suite entry (TestMain) to clear WARD_CONFIG_REF / WARD_TARGET_* and point the cache root at a temp dir, or gate the resolving code behind an injected env reader everywhere tests construct runners.

Running `go test ./...` in a shell with WARD_CONFIG_REF set makes test binaries resolve the REAL config source: the log shows `ward: config-bundle gitsync: refresh https://forgejo.coilysiren.me/...` plus live fetch output and deprecation warnings mid-suite (observed 2026-07-11, Windows host). A unit-test run should never touch the network or the operator config; a flaky Forgejo or an expired credential can redden unrelated tests, and tests can poison the real config-bundle cache. Wrap the suite entry (TestMain) to clear WARD_CONFIG_REF / WARD_TARGET_* and point the cache root at a temp dir, or gate the resolving code behind an injected env reader everywhere tests construct runners.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/ward#1128
No description provided.