From bf3df0312bdeeee30138cbe1af72757cdc0d1546 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Fri, 2 Oct 2026 18:03:31 +0200 Subject: [PATCH] Clear the environment in the cmd/webhooker tests that build a Config (closes #452) The two cmd/webhooker tests that build the app graph, TestNewApp_StopTimeout and TestNewApp_SendsFxEventsToTheLogger, built a Config without clearing the environment, so a variable exported in the developer's shell changed their result: a 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 already do. No other test outside internal/config builds a Config through config.New. Test change only. Model: opus-5-5 --- cmd/webhooker/main_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/webhooker/main_test.go b/cmd/webhooker/main_test.go index 851c4d8..ad1d5cf 100644 --- a/cmd/webhooker/main_test.go +++ b/cmd/webhooker/main_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "sneak.berlin/go/webhooker/internal/config" "sneak.berlin/go/webhooker/internal/datadir" "sneak.berlin/go/webhooker/internal/resetpw" "sneak.berlin/go/webhooker/internal/server" @@ -36,6 +37,7 @@ const dockerStopGrace = 10 * time.Second // fx.New applies options before it executes invokes, so the timeout // is set whether or not the graph itself can be constructed here. func TestNewApp_StopTimeout(t *testing.T) { + config.ClearEnvForTest(t) t.Setenv("DATA_DIR", t.TempDir()) got := newApp().StopTimeout() @@ -73,6 +75,7 @@ func freePort(t *testing.T) int { // anything is built, and the run of logger.New, which happens before // the configuration sets the level. func TestNewApp_SendsFxEventsToTheLogger(t *testing.T) { + config.ClearEnvForTest(t) t.Setenv("DATA_DIR", t.TempDir()) t.Setenv("PORT", strconv.Itoa(freePort(t))) t.Setenv("DEBUG", "true")