Skip to content

Commit d44c2b6

Browse files
cole-rgbclaude
andcommitted
Fix TestLoadMissingRequired to work in CI environment
CI sets DATABASE_URL environment variable, so the test was passing when it should have failed. Now explicitly clearing all required env vars with t.Setenv() which restores original values after test. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 975e26c commit d44c2b6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

internal/config/config_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ func TestLoad(t *testing.T) {
3030
}
3131

3232
func TestLoadMissingRequired(t *testing.T) {
33-
// t.Setenv automatically clears after test
34-
// Don't set required vars to test missing validation
33+
// Clear required environment variables to test missing validation
34+
// t.Setenv will restore the original values after the test
35+
t.Setenv("DATABASE_URL", "")
36+
t.Setenv("JWT_SECRET", "")
37+
t.Setenv("S3_BUCKET", "")
3538

3639
_, err := Load()
3740
if err == nil {

0 commit comments

Comments
 (0)