fix(tests): replace flaky sleep with retry loop in SubscriptionIndexTests
Use a 2-second deadline retry loop instead of fixed Thread.Sleep(200) for async cache sweep verification, mirroring the Go test pattern.
This commit is contained in:
@@ -360,8 +360,11 @@ public class SubscriptionIndexTests
|
|||||||
for (int i = 0; i < 2 * SubscriptionIndex.SlCacheMax; i++)
|
for (int i = 0; i < 2 * SubscriptionIndex.SlCacheMax; i++)
|
||||||
s.Match($"foo-{i}");
|
s.Match($"foo-{i}");
|
||||||
|
|
||||||
// Cache sweep runs async, wait briefly.
|
// Cache sweep runs async; mirror Go test's retry window.
|
||||||
Thread.Sleep(200);
|
var deadline = DateTime.UtcNow + TimeSpan.FromSeconds(2);
|
||||||
|
while (DateTime.UtcNow < deadline && s.CacheCount() > SubscriptionIndex.SlCacheMax)
|
||||||
|
Thread.Sleep(10);
|
||||||
|
|
||||||
s.CacheCount().ShouldBeLessThanOrEqualTo(SubscriptionIndex.SlCacheMax);
|
s.CacheCount().ShouldBeLessThanOrEqualTo(SubscriptionIndex.SlCacheMax);
|
||||||
|
|
||||||
// Test wildcard cache update.
|
// Test wildcard cache update.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# NATS .NET Porting Status Report
|
# NATS .NET Porting Status Report
|
||||||
|
|
||||||
Generated: 2026-02-28 23:39:18 UTC
|
Generated: 2026-02-28 23:44:05 UTC
|
||||||
|
|
||||||
## Modules (12 total)
|
## Modules (12 total)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user