docs: add XML doc comments to server types and fix flaky test timings

Add XML doc comments to public properties across EventTypes, Connz, Varz,
NatsOptions, StreamConfig, IStreamStore, FileStore, MqttListener,
MqttSessionStore, MessageTraceContext, and JetStreamApiResponse. Fix flaky
tests by increasing timing margins (ResponseTracker expiry 1ms→50ms,
sleep 50ms→200ms) and document known flaky test patterns in tests.md.
This commit is contained in:
Joseph Doherty
2026-03-13 18:47:48 -04:00
parent 1d4b87e5f9
commit 88a82ee860
24 changed files with 2874 additions and 216 deletions

View File

@@ -53,13 +53,12 @@ public class ReplyMapCacheTests
// Go: gateway.go — entries expire after the configured TTL window
[Fact]
[SlopwatchSuppress("SW004", "TTL expiry test requires real wall-clock time to elapse; no synchronisation primitive can replace observing a time-based cache eviction")]
public void TTL_expiration()
{
var cache = new ReplyMapCache(capacity: 16, ttlMs: 1);
var cache = new ReplyMapCache(capacity: 16, ttlMs: 50);
cache.Set("_INBOX.ttl", "_GR_.c1.1._INBOX.ttl");
Thread.Sleep(5); // Wait longer than the 1ms TTL
Thread.Sleep(200); // Wait longer than the 50ms TTL
var found = cache.TryGet("_INBOX.ttl", out var value);
@@ -126,14 +125,13 @@ public class ReplyMapCacheTests
// Go: gateway.go — PurgeExpired removes only expired entries
[Fact]
[SlopwatchSuppress("SW004", "TTL expiry test requires real wall-clock time to elapse; no synchronisation primitive can replace observing a time-based cache eviction")]
public void PurgeExpired_removes_old_entries()
{
var cache = new ReplyMapCache(capacity: 16, ttlMs: 1);
var cache = new ReplyMapCache(capacity: 16, ttlMs: 50);
cache.Set("old1", "v1");
cache.Set("old2", "v2");
Thread.Sleep(5); // Ensure both entries are past the 1ms TTL
Thread.Sleep(200); // Ensure both entries are past the 50ms TTL
var purged = cache.PurgeExpired();