Skip to content

CSHARP-4988: Fix flaky ServerMonitor test #1277

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 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,8 @@ public void RoundTripTimeMonitor_should_be_started_only_once_if_using_streaming_
mockConnection.EnqueueCommandResponseMessage(CreateHeartbeatCommandResponseMessage(), null);

subject.Initialize();
// spin until the initial handshake has happened in which case the server description state should be Connected
SpinWait.SpinUntil(() => subject.Description.State == ServerState.Connected, TimeSpan.FromSeconds(5)).Should().BeTrue();

// RTT thread should be started after first heartbeat (initial handshake)
mockRoundTripTimeMonitor.Verify(m => m.Start(), Times.Once);

SpinWait.SpinUntil(() => capturedEvents.Count >= 4, TimeSpan.FromSeconds(5)).Should().BeTrue();

mockRoundTripTimeMonitor.Verify(m => m.Start(), Times.Once);
mockRoundTripTimeMonitor.Verify(m => m.IsStarted, Times.AtLeast(4));
subject.Dispose();
Expand Down