mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
test(multiplayer): lock allocated launch overrides
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user