test(compose): report the actual status when the idempotency conflict check fails

The ERR trap added in 432e5a11 located the CI failure at the
`[[ "$conflict_status" == 409 ]]` assertion, but the request discarded
its body and the assertion printed nothing, so three failing runs never
revealed what the API actually returned.

Print the status and body on mismatch.
This commit is contained in:
Josh Creek
2026-09-05 19:27:35 +01:00
parent 432e5a11e8
commit fc2f5c8669
+13 -2
View File
@@ -146,12 +146,23 @@ queue_revision="$(python3 -c 'import json,sys; print(json.load(sys.stdin)["revis
# Reusing a queue idempotency key with different command material must not
# silently turn into a second ticket or a successful replay.
conflict_status="$(curl -sS -o /dev/null -w '%{http_code}' -X POST "$api_url/v1/queue" \
conflict_body="$(mktemp)"
conflict_status="$(curl -sS -o "$conflict_body" -w '%{http_code}' -X POST "$api_url/v1/queue" \
-H "Authorization: Bearer $access_token" \
-H 'Idempotency-Key: compose-queue-key-123456' \
-H 'Content-Type: application/json' \
-d '{"ticket_id":"compose-other-ticket","playlist":"casual","client_build":"build-1","protocol_version":1}')"
[[ "$conflict_status" == 409 ]]
if [[ "$conflict_status" != 409 ]]; then
# Report what actually came back. A bare [[ ]] here just aborts, which is
# how this assertion failed in CI three times without ever saying what the
# status was.
echo "idempotency conflict returned ${conflict_status}, want 409; body:" >&2
cat "$conflict_body" >&2 || true
echo >&2
rm -f "$conflict_body"
exit 1
fi
rm -f "$conflict_body"
heartbeat_json="$(curl -fsS -X POST "$api_url/v1/queue/compose-queue-ticket/heartbeat" \
-H "Authorization: Bearer $access_token" \