Clear the environment in the cmd/webhooker tests that build a Config (closes #452) #453

Merged
clawbot merged 1 commits from issue-452-clear-env-in-tests into next 2026-10-02 18:03:32 +02:00
Collaborator

TestNewApp_StopTimeout and TestNewApp_SendsFxEventsToTheLogger in cmd/webhooker/main_test.go both build the app graph, which runs config.New, so a variable exported in the developer's shell reached them; METRICS_USERNAME without METRICS_PASSWORD failed the second. Both now call config.ClearEnvForTest before setting their own variables, as the config tests and the first-boot test in internal/gormlog already do. Test change only.

The other tests in that file that set DATA_DIR (TestRunRefusesLockedDataDir, TestDispatch_NoArgumentsRunsTheServer) read it through config.DataDir and are refused before the graph is built, so they never run config.New and are left as they were. No other test outside internal/config builds a Config through config.New.

Judgement call: TestNewApp_StopTimeout passes whatever the shell exports, because the stop timeout is set even when the graph fails, but it does run config.New, so the issue's definition of done covers it.

Model: opus-5-5

`TestNewApp_StopTimeout` and `TestNewApp_SendsFxEventsToTheLogger` in `cmd/webhooker/main_test.go` both build the app graph, which runs `config.New`, so a variable exported in the developer's shell reached them; `METRICS_USERNAME` without `METRICS_PASSWORD` failed the second. Both now call `config.ClearEnvForTest` before setting their own variables, as the config tests and the first-boot test in `internal/gormlog` already do. Test change only. The other tests in that file that set `DATA_DIR` (`TestRunRefusesLockedDataDir`, `TestDispatch_NoArgumentsRunsTheServer`) read it through `config.DataDir` and are refused before the graph is built, so they never run `config.New` and are left as they were. No other test outside `internal/config` builds a Config through `config.New`. Judgement call: `TestNewApp_StopTimeout` passes whatever the shell exports, because the stop timeout is set even when the graph fails, but it does run `config.New`, so the issue's definition of done covers it. Model: opus-5-5
clawbot added the needs-review label 2026-10-02 17:49:44 +02:00
clawbot self-assigned this 2026-10-02 17:49:44 +02:00
clawbot added 1 commit 2026-10-02 17:49:45 +02:00
TestNewApp_StopTimeout and TestNewApp_SendsFxEventsToTheLogger both
build the app graph, which runs config.New, so a variable exported in
the developer's shell reached them: METRICS_USERNAME without
METRICS_PASSWORD failed the second. Both now call
config.ClearEnvForTest before setting their own variables, as the
config tests and the gormlog first-boot test already do.

Model: opus-5-5
Author
Collaborator

Review passed: both cmd/webhooker tests that build a Config through config.New now clear the environment first, and nothing else changed.

Model: opus-5-5

Review passed: both `cmd/webhooker` tests that build a Config through `config.New` now clear the environment first, and nothing else changed. Model: opus-5-5
clawbot merged commit bf3df0312b into next 2026-10-02 18:03:32 +02:00
clawbot deleted branch issue-452-clear-env-in-tests 2026-10-02 18:03:32 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#453