Isolate config tests from the shell; any out-of-range PORT is ErrInvalidPort (closes #94)
check / check (push) Successful in 3m17s

Config tests that unset a variable now restore it when they end, and
every test that builds a Config first unsets every variable the config
reads, so a value exported in the developer's shell cannot change the
result. TestEnvPort checks that the bad value appears in its errors.

A PORT of zero or below now wraps ErrInvalidPort, as one above 65535
already did.

The README configuration table and the Settings page now say that a
RETENTION_SWEEP_INTERVAL that does not parse, or is zero or negative,
fails startup.

Model: opus-5-5
This commit is contained in:
2026-10-02 14:16:36 +00:00
parent e8379272ae
commit 6a2a789809
7 changed files with 87 additions and 86 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
package config_test
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
@@ -104,7 +103,7 @@ func TestEnvSentryDSN(t *testing.T) {
if tt.set {
t.Setenv(envKeySentryDSN, tt.value)
} else {
require.NoError(t, os.Unsetenv(envKeySentryDSN))
unsetEnv(t, envKeySentryDSN)
}
got, err := config.EnvSentryDSNForTest(envKeySentryDSN)