test(multiplayer): lock allocated launch overrides

This commit is contained in:
Josh Creek
2026-09-01 16:09:57 +01:00
parent b4ea50d76a
commit 12b9712a8d
2 changed files with 23 additions and 0 deletions
+21
View File
@@ -13,6 +13,27 @@ import (
"time"
)
func TestWithAllocatedConfigOverridesAuthoritativeChildFlags(t *testing.T) {
command := []string{
"game-server", "--", "--allocated-mode", "--match-id=stale-match",
"--server-id=stale-server", "--server-image-digest=sha256:stale",
"--assignment-expiry-unix=1", "--region=EU", "--custom-flag=preserved",
}
expiry := time.Unix(1_900_000_000, 0).UTC()
got := withAllocatedConfig(command, "match-live", "server-live", "sha256:live", expiry)
want := []string{
"game-server", "--", "--allocated-mode", "--match-id=match-live",
"--server-id=server-live", "--server-image-digest=sha256:live",
"--assignment-expiry-unix=1900000000", "--region=EU", "--custom-flag=preserved",
}
if strings.Join(got, "\x00") != strings.Join(want, "\x00") {
t.Fatalf("allocated command = %#v, want %#v", got, want)
}
if strings.Join(command, "\x00") == strings.Join(got, "\x00") {
t.Fatal("withAllocatedConfig mutated the caller's command slice")
}
}
func TestAllocatedStartInjectsDynamicEndpointAndCallsReadyAfterProbe(t *testing.T) {
ready := false
readyCalled := false