mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 11:42:02 +00:00
test(multiplayer): extend the real integration test to cover queue cancel
Adds a fourth real round trip to control_plane_smoke.gd: heartbeat -> cancel_queue -> CANCELLED, using the same idle-wait pattern the heartbeat step already needed. Verified stable across 3 consecutive full runs (real Postgres, real testkit-api, real headless Godot client), plus the full Go and Godot unit suites clean.
This commit is contained in:
@@ -88,7 +88,13 @@ func _on_request_succeeded(operation: String, payload: Dictionary) -> void:
|
|||||||
if int(payload.get("revision", -1)) <= 0:
|
if int(payload.get("revision", -1)) <= 0:
|
||||||
_finish(false, "heartbeat did not advance the revision: %s" % payload)
|
_finish(false, "heartbeat did not advance the revision: %s" % payload)
|
||||||
return
|
return
|
||||||
_finish(true, "login -> queue_create -> heartbeat all round-tripped against a real server")
|
print("SMOKE: heartbeat advanced to revision %d, cancelling..." % ControlPlaneClient.state.revision)
|
||||||
|
_send_cancel_once_idle()
|
||||||
|
"queue_cancel":
|
||||||
|
if payload.get("state", "") != "CANCELLED":
|
||||||
|
_finish(false, "unexpected queue_cancel payload: %s" % payload)
|
||||||
|
return
|
||||||
|
_finish(true, "login -> queue_create -> heartbeat -> cancel all round-tripped against a real server")
|
||||||
|
|
||||||
|
|
||||||
func _send_heartbeat_once_idle() -> void:
|
func _send_heartbeat_once_idle() -> void:
|
||||||
@@ -104,6 +110,16 @@ func _send_heartbeat_once_idle() -> void:
|
|||||||
_finish(false, "heartbeat() failed to start: %s" % error_string(err))
|
_finish(false, "heartbeat() failed to start: %s" % error_string(err))
|
||||||
|
|
||||||
|
|
||||||
|
func _send_cancel_once_idle() -> void:
|
||||||
|
if not ControlPlaneClient._operation.is_empty():
|
||||||
|
var poll := get_tree().create_timer(0.05)
|
||||||
|
poll.timeout.connect(_send_cancel_once_idle)
|
||||||
|
return
|
||||||
|
var err := ControlPlaneClient.cancel_queue(_ticket_id, ControlPlaneClient.state.revision)
|
||||||
|
if err != OK:
|
||||||
|
_finish(false, "cancel_queue() failed to start: %s" % error_string(err))
|
||||||
|
|
||||||
|
|
||||||
func _on_request_failed(operation: String, http_code: int, detail: String) -> void:
|
func _on_request_failed(operation: String, http_code: int, detail: String) -> void:
|
||||||
if _finished:
|
if _finished:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user