test: use placeholder domains in setup and system-server tests

Three tests carried the maintainer's production root domain, a personal
mailbox and the public IP of a live demo host as fixture values. None of
them needs the value to be real: the re-domain test only needs two
different roots, and the setup flow only needs a well-formed address.

Swap them for the placeholders the rest of the suite already uses
(mc.example.net, [email protected]), and move the "before" root in the
re-domain test to 203.0.113.10.nip.io. That address is from the RFC 5737
documentation range, so the stale install the test models still has an
IP-derived hostname, which is the case the refresh exists for.
This commit is contained in:
flyemoji committed 2026-09-22 12:43:54 +09:00
1 parent d9246ddae6
commit 800a9042a1
2 files changed
+8 -8

No files matched your search

+5 -5
View File
@@ -497,7 +497,7 @@ func TestEnsureSystemServersRefreshesDerivedEnv(t *testing.T) {
// human would have added and a memory bump off the built-in default.
stale := func() *v1alpha1.MinecraftServer {
ms, err := loginSystemServer("felis-limbo:demo", "minecraft",
"http://old.internal:8081", "159.223.32.51.nip.io", "console.159.223.32.51.nip.io")
"http://old.internal:8081", "203.0.113.10.nip.io", "console.203.0.113.10.nip.io")
if err != nil {
t.Fatalf("build stale login server: %v", err)
}
@@ -509,7 +509,7 @@ func TestEnsureSystemServersRefreshesDerivedEnv(t *testing.T) {
run := func(cl client.Client) []systemServerOutcome {
return ensureSystemServers(ctx, cl, "minecraft", "felis-limbo:demo", "felis-lobby:demo",
"http://felis-api-internal.felis.svc.cluster.local:8081",
"mc.flyemoji.network", "console.mc.flyemoji.network")
"mc.example.net", "console.mc.example.net")
}
envOf := func(t *testing.T, cl client.Client) map[string]string {
@@ -537,11 +537,11 @@ func TestEnsureSystemServersRefreshesDerivedEnv(t *testing.T) {
}
}
env := envOf(t, cl)
if env[envPanelHostname] != "console.mc.flyemoji.network" {
if env[envPanelHostname] != "console.mc.example.net" {
t.Errorf("%s = %q — players are still being sent to the old console",
envPanelHostname, env[envPanelHostname])
}
if env[envRootDomain] != "mc.flyemoji.network" {
if env[envRootDomain] != "mc.example.net" {
t.Errorf("%s = %q, want the new root domain", envRootDomain, env[envRootDomain])
}
})
@@ -568,7 +568,7 @@ func TestEnsureSystemServersRefreshesDerivedEnv(t *testing.T) {
t.Run("reports no refresh when config already matches", func(t *testing.T) {
fresh, err := loginSystemServer("felis-limbo:demo", "minecraft",
"http://felis-api-internal.felis.svc.cluster.local:8081",
"mc.flyemoji.network", "console.mc.flyemoji.network")
"mc.example.net", "console.mc.example.net")
if err != nil {
t.Fatalf("build fresh login server: %v", err)
}
+3 -3
View File
@@ -40,16 +40,16 @@ func TestSetupNoSMTPFlow(t *testing.T) {
}
// 2. Record the email — NO OTP. The row is written but email_verified stays false.
w := do(h, "POST", "/api/v1/account/email", `{"email":"[email protected]"}`, jsonHeader)
w := do(h, "POST", "/api/v1/account/email", `{"email":"[email protected]"}`, jsonHeader)
if w.Code != http.StatusOK {
t.Fatalf("set-email code = %d, want 200 (%s)", w.Code, w.Body.String())
}
if u := repo.staff["owner"]; u.Email != "[email protected]" || u.EmailVerified {
if u := repo.staff["owner"]; u.Email != "[email protected]" || u.EmailVerified {
t.Fatalf("after record: email=%q verified=%v, want the address recorded and UNVERIFIED", u.Email, u.EmailVerified)
}
// 3. Email recorded but no passkey → STILL required (email verification is not the gate).
if s := status(t); s["setup_required"] != true || s["email"] != "[email protected]" {
if s := status(t); s["setup_required"] != true || s["email"] != "[email protected]" {
t.Fatalf("email-only status = %v, want setup_required=true (passkey still missing)", s)
}