test(multiplayer): verify live assignment delivery

This commit is contained in:
Josh Creek
2026-09-01 15:25:36 +01:00
parent 79a6092b28
commit f096e8ff0b
5 changed files with 59 additions and 5 deletions
+21 -1
View File
@@ -23,6 +23,8 @@ const TIMEOUT_SECONDS := 10.0
var _finished := false
var _ticket_id := ""
var _assignment_match_id := ""
var _steam_ticket := ""
func _ready() -> void:
@@ -30,6 +32,10 @@ func _ready() -> void:
for arg in OS.get_cmdline_user_args():
if arg.begins_with("--control-plane-url="):
control_plane_url = arg.substr("--control-plane-url=".length())
elif arg.begins_with("--assignment-match-id="):
_assignment_match_id = arg.substr("--assignment-match-id=".length())
elif arg.begins_with("--steam-ticket="):
_steam_ticket = arg.substr("--steam-ticket=".length())
if control_plane_url.is_empty():
_finish(false, "missing --control-plane-url")
return
@@ -45,7 +51,7 @@ func _ready() -> void:
ControlPlaneClient.request_succeeded.connect(_on_request_succeeded)
ControlPlaneClient.request_failed.connect(_on_request_failed)
var web_api_ticket := "smoke-web-api-ticket-%d" % Time.get_ticks_usec()
var web_api_ticket := _steam_ticket if not _steam_ticket.is_empty() else "smoke-web-api-ticket-%d" % Time.get_ticks_usec()
var err := ControlPlaneClient.login_steam(web_api_ticket)
if err != OK:
_finish(false, "login_steam() failed to start: %s" % error_string(err))
@@ -65,10 +71,21 @@ func _on_request_succeeded(operation: String, payload: Dictionary) -> void:
return
match operation:
"steam_session":
if not _assignment_match_id.is_empty():
print("SMOKE: logged in as %s, fetching player-scoped assignment..." % ControlPlaneClient.player_id)
var err := ControlPlaneClient.fetch_assignment(_assignment_match_id)
if err != OK:
_finish(false, "fetch_assignment() failed to start: %s" % error_string(err))
return
print("SMOKE: logged in as %s, fetching ranked profile (expect none yet)..." % ControlPlaneClient.player_id)
var err := ControlPlaneClient.fetch_ranked_profile()
if err != OK:
_finish(false, "fetch_ranked_profile() failed to start: %s" % error_string(err))
"assignment":
if payload.get("match_id", "") != _assignment_match_id or payload.get("player_id", "") != ControlPlaneClient.player_id or not ControlPlaneClient.assignment.available:
_finish(false, "unexpected assignment payload: %s" % payload)
return
_finish(true, "authenticated assignment fetch returned the player-scoped endpoint and join authorisation")
"ranked_profile":
_finish(false, "a brand-new testkit identity unexpectedly already has a ranked profile: %s" % payload)
"queue_create":
@@ -134,6 +151,9 @@ func _on_request_failed(operation: String, http_code: int, detail: String) -> vo
if err != OK:
_finish(false, "queue_create() failed to start: %s" % error_string(err))
return
if operation == "assignment":
_finish(false, "assignment fetch failed: http=%d detail=%s" % [http_code, detail])
return
_finish(false, "%s failed: http=%d detail=%s" % [operation, http_code, detail])