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:
@@ -25,6 +25,7 @@
|
||||
using System.Text;
|
||||
using NATS.Server.JetStream.Models;
|
||||
using NATS.Server.JetStream.Storage;
|
||||
using NATS.Server.TestUtilities;
|
||||
|
||||
namespace NATS.Server.JetStream.Tests.JetStream.Storage;
|
||||
|
||||
@@ -335,7 +336,7 @@ public sealed class FileStoreTombstoneTests : IDisposable
|
||||
// After restart the message should still be present (not yet expired),
|
||||
// and after waiting 2 seconds it should expire.
|
||||
[Fact]
|
||||
public void MessageTTL_RecoverSingleMessageWithoutStreamState()
|
||||
public async Task MessageTTL_RecoverSingleMessageWithoutStreamState()
|
||||
{
|
||||
var dir = UniqueDir("ttl-recover");
|
||||
var opts = new FileStoreOptions { Directory = dir, MaxAgeMs = 1000 };
|
||||
@@ -358,8 +359,8 @@ public sealed class FileStoreTombstoneTests : IDisposable
|
||||
ss.LastSeq.ShouldBe(1UL);
|
||||
ss.Msgs.ShouldBe(1UL);
|
||||
|
||||
// Wait for TTL to expire.
|
||||
Thread.Sleep(2000);
|
||||
// Wait for TTL to expire (1s TTL + generous margin).
|
||||
await Task.Delay(2_500);
|
||||
|
||||
// Force expiry by storing a new message (expiry check runs before store).
|
||||
store.StoreMsg("test", null, [], 0);
|
||||
@@ -373,7 +374,7 @@ public sealed class FileStoreTombstoneTests : IDisposable
|
||||
// After TTL expiry and restart (without stream state file),
|
||||
// a tombstone should allow proper recovery of the stream state.
|
||||
[Fact]
|
||||
public void MessageTTL_WriteTombstoneAllowsRecovery()
|
||||
public async Task MessageTTL_WriteTombstoneAllowsRecovery()
|
||||
{
|
||||
var dir = UniqueDir("ttl-tombstone");
|
||||
var opts = new FileStoreOptions { Directory = dir, MaxAgeMs = 1000 };
|
||||
@@ -388,8 +389,8 @@ public sealed class FileStoreTombstoneTests : IDisposable
|
||||
ss.FirstSeq.ShouldBe(1UL);
|
||||
ss.LastSeq.ShouldBe(2UL);
|
||||
|
||||
// Wait for seq=1 to expire.
|
||||
Thread.Sleep(1500);
|
||||
// Wait for seq=1 to expire (1s TTL + generous margin).
|
||||
await Task.Delay(2_500);
|
||||
|
||||
// Force expiry.
|
||||
store.StoreMsg("test", null, [], 0);
|
||||
@@ -629,7 +630,6 @@ public sealed class FileStoreTombstoneTests : IDisposable
|
||||
cs1.UpdateDelivered(5, 2, 1, ts);
|
||||
|
||||
cs1.Stop();
|
||||
Thread.Sleep(20); // wait for flush
|
||||
|
||||
// Reopen — should recover redelivered.
|
||||
var cs2 = store.ConsumerStore("o22", DateTime.UtcNow, cfg);
|
||||
@@ -641,7 +641,6 @@ public sealed class FileStoreTombstoneTests : IDisposable
|
||||
cs2.UpdateDelivered(7, 3, 1, ts);
|
||||
|
||||
cs2.Stop();
|
||||
Thread.Sleep(20);
|
||||
|
||||
// Reopen again.
|
||||
var cs3 = store.ConsumerStore("o22", DateTime.UtcNow, cfg);
|
||||
@@ -654,7 +653,6 @@ public sealed class FileStoreTombstoneTests : IDisposable
|
||||
cs3.UpdateAcks(6, 2);
|
||||
|
||||
cs3.Stop();
|
||||
Thread.Sleep(20);
|
||||
|
||||
// Reopen and ack 4.
|
||||
var cs4 = store.ConsumerStore("o22", DateTime.UtcNow, cfg);
|
||||
|
||||
Reference in New Issue
Block a user