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

Fix the flaky LingeringRoundRobinLoadBalancerTest #2732

Conversation

bryce-anderson
Copy link
Contributor

@bryce-anderson bryce-anderson commented Oct 18, 2023

Motivation:

The test expiringAHostDoesntRaceWithConnectionAdding is flaky but only in CI.
This is because locally we essentially never hit the else branch where the
connection was added first but it does happen in CI. The else branch of the
test is flawed: the host is marked as EXPIRED and thus unhealthy, so we should
always expect a NoActiveHostException instead of a NoAvailableHostException.

Modifications:

Change the expected exception to NoActiveHostException.

Result:

Less flakiness.

Closes #2677.

Testing

The else branch can be tested locally by waiting for the future f to complete
before sending the service discovery event, eg adding a f.get() right after
the assignment of f.

Motivation:

The test `expiringAHostDoesntRaceWithConnectionAdding` is flaky
but only in CI. This is because locally we never hit the `else`
branch where the connection was added first but it does happen
in CI. That branch of the test is flawed: the host is marked
as EXPIRED and thus unhealthy, so we should always expect a
NoActiveHostException instead of a NoAvailableHostException.

Note that this branch can be tested by wating for the future `f`
to complete before sending the service discovery event.

Modifications:

Change the expected exception to NoActiveHostException.

Result:

Test shouldn't be flaky anymore.
Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

Thank you!

@bryce-anderson bryce-anderson merged commit 61973fe into apple:main Oct 18, 2023
15 checks passed
@bryce-anderson bryce-anderson deleted the bl_anderson/LingeringRoundRobinLoadBalancerTestFlakyness branch October 18, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LingeringRoundRobinLoadBalancerTest failure
2 participants