Skip to content

test(marketplace): wait for the submit webhook instead of sleeping 200ms - #366

Merged
vsilent merged 1 commit into
all-fixesfrom
test/wait-for-submit-webhook
Nov 20, 2026
Merged

vsilent merged 1 commit into
all-fixesfrom
test/wait-for-submit-webhook

Conversation

@vsilent

@vsilent vsilent commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

What

PR #361's CI failed at random on marketplace_create_template submit_template_sends_template_submitted_webhook ("Submit should send marketplace webhook") — on a branch that touches only secrets.rs. The webhook is dispatched from a detached tokio::spawn (creator.rs send_submit_webhook), so it reaches the wiremock after the submit response; the test slept a fixed 200 ms and then asserted, and under CI load — right after the long build — the spawn had not landed yet.

The same race was already fixed in tests/marketplace_admin_review.rs (wait_for_marketplace_sync_payload — its comment says exactly this: "a fixed 200 ms sleep was too short on a loaded CI runner and failed the suite at random"). This applies the identical bounded-poll pattern to the one test that still had the raw sleep.

How

wait_for_submit_webhook polls received_requests() every 50 ms for up to 5 s and returns the /marketplace/sync request; the test fails only if the webhook truly never arrives.

Tests

marketplace_create_template suite: 28 passed (including the hardened one).

The submit webhook is dispatched from a detached `tokio::spawn`, so it
reaches the wiremock some time after the submit response. The test slept a
fixed 200 ms and then asserted — under CI load (right after the long build)
the spawn had not landed yet and the suite failed at random with "Submit
should send marketplace webhook" (seen on PR #361's CI; the branch touches
only secrets.rs).

The same race was already fixed in tests/marketplace_admin_review.rs with a
bounded poll — this applies the identical pattern here: poll for 5 s, fail
only if the webhook truly never arrives.

Co-Authored-By: Claude Opus 5 <[email protected]>
@vsilent
vsilent changed the base branch from dev to all-fixes November 20, 2026 20:13
@vsilent
vsilent merged commit 4ef0872 into all-fixes Nov 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants