fix(test): let the echo's Result decide default_echo

The select arm discarded test_echo_messages' Result, so the test passed
whenever that future finished -- including the path where the message
never arrived and it returned Err. Only the 1000s timeout could fail it,
which made the assertion close to vacuous for the case it exists to
cover.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ivan FB 2026-07-16 01:09:34 +02:00
parent 430ebc0bda
commit 6a107e66cc
No known key found for this signature in database
GPG Key ID: DF0C67A04C543270

View File

@ -127,12 +127,14 @@ async fn default_echo() -> Result<(), String> {
tokio::pin!(sleep);
// Send and receive messages. Waits until all messages received.
// The echo's Result decides the outcome: completing is not the same as
// having received the message.
let got_all = tokio::select! {
_ = sleep => false,
_ = test_echo_messages(node1, node2, ECHO_MESSAGE, content_topic) => true,
_ = sleep => Err("timed out waiting for the echo".to_string()),
result = test_echo_messages(node1, node2, ECHO_MESSAGE, content_topic) => result,
};
assert!(got_all);
got_all?;
Ok(())
}