test(multiplayer): harden ranked arena provider boundary

This commit is contained in:
Josh Creek
2026-09-01 21:13:04 +01:00
parent 0666d8d308
commit d4bde67e0f
+12
View File
@@ -17,6 +17,18 @@ func request() domain.AllocationRequest {
return domain.AllocationRequest{AllocationID: "allocation-1", MatchID: "match-1", Region: "EU", Build: "build-1", Protocol: 1, Transport: "enet"}
}
func TestAllocateRejectsRankedRequestsWithoutRegisteredArena(t *testing.T) {
client := Client{BaseURL: "http://127.0.0.1:1", Namespace: "games"}
for _, path := range []string{"", "res://scenes/arena_01_elevated.tscn", "res://forged.tscn"} {
req := request()
req.Playlist = domain.Ranked
req.ArenaPath = path
if _, err := client.Allocate(context.Background(), req, map[string]string{"region": "EU"}, time.Unix(1000, 0)); err != domain.ErrAllocationInput {
t.Fatalf("ranked arena path %q returned %v, want ErrAllocationInput", path, err)
}
}
}
func TestAllocateBuildsStrictGameServerAllocationAndEndpoint(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost || r.URL.Path != "/apis/allocation.agones.dev/v1/namespaces/games/gameserverallocations" {