Skip to content

Fix flakey test #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2025
Merged

Fix flakey test #268

merged 2 commits into from
Mar 4, 2025

Conversation

eloff
Copy link
Contributor

@eloff eloff commented Mar 3, 2025

Skips over any msgN messages until finding the disconnect message. This makes the test robust if the consumer and producer happen to interleave in a way that one or more of the messages go through.

Hopefully this is enough now.

@eloff eloff requested review from bryfox, gasmith and Copilot March 3, 2025 19:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR fixes a flaky test by modifying the test flow to skip intermediary "msg" messages until a disconnect message is received.

  • Introduces a loop to ignore non-disconnect messages.
  • Refines message parsing by extracting the message text for comparison.

Reviewed Changes

File Description
rust/foxglove/src/websocket/tests.rs Updated test logic to handle interleaved messages robustly.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

rust/foxglove/src/websocket/tests.rs:1445

  • The comment contains a spelling error: 'disconencted' should be corrected to 'disconnected'.
// Client should have been disconencted

Comment on lines 1444 to 1445
loop {
// Client should have been disconencted
Copy link
Preview

Copilot AI Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a timeout or a maximum iteration safeguard in this loop to prevent a potential infinite loop if the expected disconnect message is never received.

Suggested change
loop {
// Client should have been disconencted
let mut iteration_count = 0;
let max_iterations = 100; // Set a reasonable limit for the number of iterations
loop {
iteration_count += 1;
if iteration_count > max_iterations {
panic!("Exceeded maximum iterations while waiting for disconnect message");
}
// Client should have been disconnected

Copilot uses AI. Check for mistakes.

@eloff eloff merged commit 77c8a6b into main Mar 4, 2025
36 checks passed
@eloff eloff deleted the dan/test-flake branch March 4, 2025 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants