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:
@@ -14,6 +14,7 @@
|
||||
|
||||
using NATS.Server.JetStream.Models;
|
||||
using NATS.Server.JetStream.Storage;
|
||||
using NATS.Server.TestUtilities;
|
||||
|
||||
namespace NATS.Server.JetStream.Tests.JetStream.Storage;
|
||||
|
||||
@@ -286,8 +287,7 @@ public sealed class StoreInterfaceTests
|
||||
|
||||
// Go: TestStoreUpdateConfigTTLState server/store_test.go:574
|
||||
[Fact]
|
||||
[SlopwatchSuppress("SW004", "TTL expiry test requires real wall-clock time to elapse; Thread.Sleep waits for message TTL to expire or survive")]
|
||||
public void UpdateConfigTTLState_MessageSurvivesWhenTtlDisabled()
|
||||
public async Task UpdateConfigTTLState_MessageSurvivesWhenTtlDisabled()
|
||||
{
|
||||
var cfg = new StreamConfig
|
||||
{
|
||||
@@ -301,7 +301,7 @@ public sealed class StoreInterfaceTests
|
||||
|
||||
// TTLs disabled — message with ttl=1s should survive even after 2s.
|
||||
var (seq, _) = s.StoreMsg("foo", null, [], 1);
|
||||
Thread.Sleep(2_000);
|
||||
await Task.Delay(2_500);
|
||||
// Should not throw — message should still be present.
|
||||
var loaded = s.LoadMsg(seq, null);
|
||||
loaded.Sequence.ShouldBe(seq);
|
||||
@@ -312,9 +312,11 @@ public sealed class StoreInterfaceTests
|
||||
|
||||
// TTLs enabled — message with ttl=1s should expire.
|
||||
var (seq2, _) = s.StoreMsg("foo", null, [], 1);
|
||||
Thread.Sleep(2_500);
|
||||
// Should throw — message should have expired.
|
||||
Should.Throw<KeyNotFoundException>(() => s.LoadMsg(seq2, null));
|
||||
await PollHelper.WaitOrThrowAsync(() =>
|
||||
{
|
||||
try { s.LoadMsg(seq2, null); return false; }
|
||||
catch (KeyNotFoundException) { return true; }
|
||||
}, "TTL expiry", timeoutMs: 10_000, intervalMs: 100);
|
||||
|
||||
// Now disable TTLs again.
|
||||
cfg.AllowMsgTtl = false;
|
||||
@@ -322,7 +324,7 @@ public sealed class StoreInterfaceTests
|
||||
|
||||
// TTLs disabled — message with ttl=1s should survive.
|
||||
var (seq3, _) = s.StoreMsg("foo", null, [], 1);
|
||||
Thread.Sleep(2_000);
|
||||
await Task.Delay(2_500);
|
||||
// Should not throw — TTL wheel is gone so message stays.
|
||||
var loaded3 = s.LoadMsg(seq3, null);
|
||||
loaded3.Sequence.ShouldBe(seq3);
|
||||
|
||||
Reference in New Issue
Block a user