test(system): the rotation fixture uses a listen address without an IP (#2026)

This commit is contained in:
sam committed 2026-11-16 13:48:07 +11:00
1 parent 52b027955b
commit 21de660ae1
1 file changed
+3 -3
+3 -3
View File
@@ -13,7 +13,7 @@ func TestWriteAdminHashReplacesOnlyTheHash(t *testing.T) {
const oldHash = "1111111111111111111111111111111111111111111111111111111111111111"
const newHash = "2222222222222222222222222222222222222222222222222222222222222222"
path := filepath.Join(t.TempDir(), "config.toml")
before := "listen = \"127.0.0.1:8080\"\nadmin_token_sha256 = \"" + oldHash + "\"\n"
before := "listen = \":8080\"\nadmin_token_sha256 = \"" + oldHash + "\"\n"
if err := os.WriteFile(path, []byte(before), 0o600); err != nil {
t.Fatal(err)
}
@@ -32,7 +32,7 @@ func TestWriteAdminHashReplacesOnlyTheHash(t *testing.T) {
t.Fatal("the old hash is still in the config")
case !strings.Contains(text, newHash):
t.Fatal("the new hash was not written")
case !strings.Contains(text, `listen = "127.0.0.1:8080"`):
case !strings.Contains(text, `listen = ":8080"`):
t.Fatal("rotation changed another setting")
}
info, err := os.Stat(path) //nolint:gosec // a test fixture in t.TempDir.
@@ -49,7 +49,7 @@ func TestWriteAdminHashReplacesOnlyTheHash(t *testing.T) {
func TestWriteAdminHashAddsAMissingLine(t *testing.T) {
const hash = "3333333333333333333333333333333333333333333333333333333333333333"
path := filepath.Join(t.TempDir(), "config.toml")
if err := os.WriteFile(path, []byte("listen = \"127.0.0.1:8080\"\n"), 0o600); err != nil {
if err := os.WriteFile(path, []byte("listen = \":8080\"\n"), 0o600); err != nil {
t.Fatal(err)
}
if err := WriteAdminHash(path, hash); err != nil {