Skip to content

Commit

Permalink
Fix test?
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Aug 30, 2023
1 parent 85ad260 commit 9cc796f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/Grpc.Net.Client.Tests/Balancer/RoundRobinBalancerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,28 @@ await BalancerWaitHelpers.WaitForSubchannelsToBeReadyAsync(
// Test that the channel's address was updated with new attribute with new attributes.
Assert.AreSame(preservedSubchannel2.CurrentAddress, address2);

lock (subChannelConnections)
try
{
Assert.AreEqual(4, subChannelConnections.Count);
await TestHelpers.AssertIsTrueRetryAsync(() =>
{
lock (subChannelConnections)
{
return subChannelConnections.Count == 4;
}
}, "Wait for connections to be recorded.");

Assert.Contains(discardedSubchannel, subChannelConnections);
Assert.Contains(preservedSubchannel1, subChannelConnections);
Assert.Contains(preservedSubchannel2, subChannelConnections);
Assert.Contains(newSubchannel, subChannelConnections);
}
catch (Exception ex)
{
lock (subChannelConnections)
{
throw new Exception("Connected subchannels: " + Environment.NewLine + string.Join(Environment.NewLine, subChannelConnections), ex);
}
}
}
}
#endif

0 comments on commit 9cc796f

Please sign in to comment.