feat: add resilient reconnect and catch-up replay

This commit is contained in:
Joseph Doherty
2026-03-17 11:04:19 -04:00
parent c278f98496
commit 2f04ec9d1d
29 changed files with 3746 additions and 95 deletions

View File

@@ -98,6 +98,37 @@ public sealed class SuiteLinkConnectionOptionsTests
Assert.Equal("America/Indiana/Indianapolis", options.Timezone);
}
[Fact]
public void Constructor_DefaultsRuntimeOptions()
{
var options = Create();
Assert.NotNull(options.Runtime);
Assert.Equal(SuiteLinkCatchUpPolicy.None, options.Runtime.CatchUpPolicy);
Assert.NotNull(options.Runtime.RetryPolicy);
Assert.Equal(TimeSpan.FromSeconds(2), options.Runtime.CatchUpTimeout);
}
[Fact]
public void Constructor_RuntimeWithNullRetryPolicy_ThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>(() => Create(runtime: new SuiteLinkRuntimeOptions(
retryPolicy: null!,
catchUpPolicy: SuiteLinkCatchUpPolicy.None,
catchUpTimeout: TimeSpan.FromSeconds(2))));
}
[Theory]
[InlineData(0)]
[InlineData(-1)]
public void Constructor_RuntimeWithNonPositiveCatchUpTimeout_ThrowsArgumentOutOfRangeException(int seconds)
{
Assert.Throws<ArgumentOutOfRangeException>(() => Create(runtime: new SuiteLinkRuntimeOptions(
retryPolicy: SuiteLinkRetryPolicy.Default,
catchUpPolicy: SuiteLinkCatchUpPolicy.None,
catchUpTimeout: TimeSpan.FromSeconds(seconds))));
}
private static SuiteLinkConnectionOptions Create(
string host = "127.0.0.1",
string application = "TestApp",
@@ -107,7 +138,8 @@ public sealed class SuiteLinkConnectionOptionsTests
string userName = "User",
string serverNode = "Server",
string? timezone = null,
int port = 5413)
int port = 5413,
SuiteLinkRuntimeOptions? runtime = null)
{
return new SuiteLinkConnectionOptions(
host,
@@ -118,6 +150,7 @@ public sealed class SuiteLinkConnectionOptionsTests
userName,
serverNode,
timezone,
port);
port,
runtime);
}
}