Skip to content

test(relay): wait for the resume reply after reconnect - #262

Open
AndrewKirkovski wants to merge 1 commit into
masterfrom
test/relay-reconnect-shutdown-echo
Open

AndrewKirkovski wants to merge 1 commit into
masterfrom
test/relay-reconnect-shutdown-echo

Conversation

@AndrewKirkovski

Copy link
Copy Markdown
Contributor

Fixes a race in the relay runtime test "cancels retirement on reconnect and continues using the same session plugin". It failed once in CI on #260 with expected "after reconnect", got nil, although #260 does not touch relay.

Cause. The fixture plugin answers every message through the hub, including each shutdown. The hub forwards plugin answers to the clients connected at that moment (broadcast_to_clients). The test sends JOIN as soon as it sees the second shutdown in the lifecycle channel. When the plugin's answer to that shutdown reaches the hub after the JOIN, the hub forwards it to the test. The test then reads it where it expects the resume echo, and every later read is one reply early. The read that expects the echo gets the release answer, which has no data.

Fix. Test-only. After the reconnect, skip late shutdown answers and assert that the next answer is the resume echo. No runtime code changes.

Evidence (local, src/relay/test with the module's make test overrides):

  • Control: a temporary 300 ms delay in the fixture before its shutdown answer (not committed) makes the current test fail every time with the same CI message, at the same line, while the other 25 tests pass.
  • With the fix and the same delay, all 26 relay-runtime tests pass.
  • Without the delay: the full module suite passes (relay 45/45, relay-runtime 26/26), three more relay-runtime runs pass, and lint reports no issues.

scripts/run-wippy.sh was not used locally because jq is not installed on that machine. The test folder's own config already replaces wippy/test with src/test, as the script does.

The fixture plugin answers each shutdown through the hub, and the hub forwards plugin answers to the clients connected at that moment. When the second shutdown answer reaches the hub after the test's JOIN, the test receives it where it expects the resume echo, and every later read is one reply early. Skip late shutdown answers and assert the resume echo.
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.

1 participant