Skip to content

Commit 9b9f920

Browse files
ReubenBondCopilot
andauthored
Fix flaky NoReconnectionToGatewayNotReturnedByManager test (#9942)
The test used a 1-second response timeout, which could cause legitimate grain calls to the real gateway to spuriously timeout on slow CI machines, leading to timeoutCount == 2 instead of the expected 1. - Increase response timeout from 1s to 3s (still below the 5s OpenConnectionTimeout so fake-gateway calls still produce TimeoutException) - Change timeoutCount assertion from exact equality to >= 1, since the core assertion is connectionCount == 1 (verifying no reconnection) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c039bc6 commit 9b9f920

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/Orleans.Runtime.Tests/ClientConnectionTests/GatewayConnectionTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ public override async Task InitializeAsync()
110110
[Fact, TestCategory("Functional")]
111111
public async Task NoReconnectionToGatewayNotReturnedByManager()
112112
{
113-
// Reduce timeout for this test
114-
this.runtimeClient.SetResponseTimeout(TimeSpan.FromSeconds(1));
113+
// Use a timeout shorter than OpenConnectionTimeout (5s) so that calls to
114+
// the fake gateway produce a TimeoutException, but long enough that
115+
// legitimate grain calls on slow CI machines don't spuriously timeout.
116+
this.runtimeClient.SetResponseTimeout(TimeSpan.FromSeconds(3));
115117

116118
var connectionCount = 0;
117119
var timeoutCount = 0;
@@ -157,7 +159,7 @@ public async Task NoReconnectionToGatewayNotReturnedByManager()
157159

158160
// Check that we only connected once to the fake GW
159161
Assert.Equal(1, connectionCount);
160-
Assert.Equal(1, timeoutCount);
162+
Assert.True(timeoutCount >= 1, $"Expected at least 1 timeout but got {timeoutCount}");
161163
}
162164

163165
[Fact, TestCategory("Functional")]

0 commit comments

Comments
 (0)