Skip to content

Commit 31cf306

Browse files
authored
Fix Clustering.ConnectMembersTests.TestDelayedQue (#1020)
closes #1018 The `MemberRequest` and queue were using different time sources, that was causing slightly differences in new runtimes due to their better performance. Now, both are using same source, there is no differences anymore.
1 parent a2f8e45 commit 31cf306

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Hazelcast.Net.Tests/Clustering/ConnectMembersTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,12 @@ await AssertEx.SucceedsEventually(() =>
246246
cancellation.Cancel();
247247
await connecting.CfAwaitCanceled();
248248

249-
// each member retried twice = twice the 1s delay = 2s
249+
// each member retried twice = twice the ~1s delay ~ 2s
250250
// we should not have completed faster than that, even so the code runs fully in-memory
251-
Assert.That(elapsed, Is.GreaterThanOrEqualTo(TimeSpan.FromSeconds(2)));
251+
// Note: The queue has 10ms error margin per wait, so we take 20ms total margin for two unsuccessful tries
252+
var failedCount = successCount - 1;
253+
var expectedMinTotalDelay = TimeSpan.FromMilliseconds(failedCount * 990); // 990ms per failed try including 10ms margin
254+
Assert.That(elapsed, Is.GreaterThanOrEqualTo(expectedMinTotalDelay));
252255
HConsole.WriteLine(this, $"Elapsed: {elapsed}");
253256

254257
Assert.That(queue.Count, Is.EqualTo(0));

0 commit comments

Comments
 (0)