fix(boot-test): run every boot test with exactly what a new server gets
CI's boot test gave every blank password-like setting a throwaway value. A real deploy only fills x-generate fields, so a template whose server won't start without one passed CI and failed for the first owner who deployed it. boottest-payload now fills only x-generate fields, for CI and the builder alike. The old behaviour is kept as -fill-blank-passwords, used only by the builder's second boot to tell whether an empty setting is why a draft fails. Messages and AUTHORING.md no longer say boot tests fill passwords; a server that needs a join password gets x-generate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
98ba043bec
commit
fe790ad223
6 files changed
+35
-32
No files matched your search
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBootTestPayloadOnlyFillsBlankPasswords(t *testing.T) {
|
||||
func TestBootTestPayloadIsWhatANewServerGets(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
game := filepath.Join(dir, "games", "demo")
|
||||
if err := os.MkdirAll(game, 0o755); err != nil {
|
||||
@@ -52,10 +52,12 @@ configSchema:
|
||||
if c["ENABLE_RCON"] != true {
|
||||
t.Errorf("ENABLE_RCON changed to %v", c["ENABLE_RCON"])
|
||||
}
|
||||
for _, k := range []string{"RCON_PASSWORD", "ServerPassword"} {
|
||||
if s, _ := c[k].(string); !strings.HasPrefix(s, "boot-") {
|
||||
t.Errorf("%s not filled: %v", k, c[k])
|
||||
}
|
||||
// Exactly what a new server gets: the x-generate password is made, a blank join password stays blank
|
||||
if s, _ := c["RCON_PASSWORD"].(string); !strings.HasPrefix(s, "boot-") {
|
||||
t.Errorf("x-generate RCON_PASSWORD not filled: %v", c["RCON_PASSWORD"])
|
||||
}
|
||||
if c["ServerPassword"] != "" {
|
||||
t.Errorf("ServerPassword must stay empty, as for a new server: %v", c["ServerPassword"])
|
||||
}
|
||||
if c["AdminPassword"] != "kept-by-owner" {
|
||||
t.Errorf("AdminPassword overwritten: %v", c["AdminPassword"])
|
||||
@@ -64,8 +66,8 @@ configSchema:
|
||||
t.Errorf("placeholders not resolved: %v", c["MOTD"])
|
||||
}
|
||||
|
||||
// As a new server gets it (what the AI builder boots): only x-generate is filled, a blank join password stays blank
|
||||
if err := runBootTestPayload([]string{"-as-deployed", "-games", filepath.Join(dir, "games"), "-out", out, "demo"}); err != nil {
|
||||
// Only for the builder's diagnosis: blank passwords filled too
|
||||
if err := runBootTestPayload([]string{"-fill-blank-passwords", "-games", filepath.Join(dir, "games"), "-out", out, "demo"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
raw, _ = os.ReadFile(out)
|
||||
@@ -73,10 +75,7 @@ configSchema:
|
||||
if err := json.Unmarshal(raw, &payload); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if s, _ := payload.GameConfig["RCON_PASSWORD"].(string); !strings.HasPrefix(s, "boot-") {
|
||||
t.Errorf("as deployed: x-generate RCON_PASSWORD not filled: %v", payload.GameConfig["RCON_PASSWORD"])
|
||||
}
|
||||
if payload.GameConfig["ServerPassword"] != "" {
|
||||
t.Errorf("as deployed: ServerPassword should stay empty, got %v", payload.GameConfig["ServerPassword"])
|
||||
if s, _ := payload.GameConfig["ServerPassword"].(string); !strings.HasPrefix(s, "boot-") {
|
||||
t.Errorf("-fill-blank-passwords: ServerPassword not filled: %v", payload.GameConfig["ServerPassword"])
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user