From 7026a92f9171356672658ca52282e8a31159d860 Mon Sep 17 00:00:00 2001 From: Andrei Kirkouski Date: Thu, 12 Nov 2026 12:23:28 +0100 Subject: [PATCH] test(relay): wait for the resume reply after reconnect 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. --- src/relay/test/relay_runtime_test.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/relay/test/relay_runtime_test.lua b/src/relay/test/relay_runtime_test.lua index 61fb834..fcd5ca8 100644 --- a/src/relay/test/relay_runtime_test.lua +++ b/src/relay/test/relay_runtime_test.lua @@ -192,7 +192,11 @@ local function define_tests() control("shutdown", 2) test.eq(join().client_count, 1) control("resume") - receive(response) -- resume is echoed by the fixture + -- The fixture also answers each shutdown. A shutdown answer that reaches the + -- hub after the JOIN above is forwarded to this client, so skip it. + local resumed = receive(response) + while resumed.topic == "shutdown" do resumed = receive(response) end + test.eq(resumed.topic, "resume") -- resume is echoed by the fixture send({type = "session_release"}) test.eq(receive(response).plugin_pid, plugin.pid) send({type = "session_echo", data = "after reconnect"})