Skip to content
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

CSHARP-3986: Fix flaky ConnectionPool_cleared_on_failed_hello test #1326

Merged
merged 5 commits into from
May 21, 2024

Conversation

sanych-sun
Copy link
Member

No description provided.

@sanych-sun sanych-sun requested a review from BorisDog May 18, 2024 00:18
@sanych-sun sanych-sun requested a review from a team as a code owner May 18, 2024 00:18
@sanych-sun sanych-sun removed the request for review from a team May 21, 2024 16:14
@@ -116,6 +116,32 @@ public object Next()
}
}

public int RemoveWhile(Func<object,bool> predicate)
Copy link
Contributor

Choose a reason for hiding this comment

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

btw, we can start using IEvent in such APIs (and then check IEvent.Type == EventType.MyEvent)
Also consider if just using SkipWhile is sufficient:

For example

var events = eventCapturer.Events
   .OfType<IEvent>()
   .SkipWhile(e => e.Type == EventType.ServerHeartbeatSucceeded);

  events.ElementAt(0).Should().BeOfType<ServerHeartbeatFailedEvent>();
  events.ElementAt(1).Should().BeOfType<ServerHeartbeatSucceededEvent>();

  events = events.SkipWhile(e => e.Type == EventType.ServerHeartbeatSucceeded);

  events.ElementAt(0).Should().BeOfType<ServerHeartbeatSucceededEvent>();
  events.ElementAt(1).Should().BeOfType<ConnectionPoolReadyEvent>();

Copy link
Contributor

@BorisDog BorisDog left a comment

Choose a reason for hiding this comment

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

LGTM

@sanych-sun sanych-sun merged commit 886da07 into mongodb:master May 21, 2024
25 of 28 checks passed
@sanych-sun sanych-sun deleted the csharp3986 branch May 21, 2024 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants