238 lines
6.3 KiB
C#
238 lines
6.3 KiB
C#
using Shouldly;
|
|
using ZB.MOM.NatsNet.Server;
|
|
using ZB.MOM.NatsNet.Server.Internal;
|
|
|
|
namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog;
|
|
|
|
public sealed class JetStreamLeafNodeTests
|
|
{
|
|
[Fact] // T:1403
|
|
public void JetStreamLeafNodeUniqueServerNameCrossJSDomain_ShouldSucceed()
|
|
{
|
|
var goFile = "server/jetstream_leafnode_test.go";
|
|
|
|
goFile.ShouldStartWith("server/");
|
|
|
|
ServerConstants.DefaultPort.ShouldBe(4222);
|
|
|
|
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
|
|
|
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
|
|
|
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
|
|
|
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
|
|
|
}
|
|
|
|
"JetStreamLeafNodeUniqueServerNameCrossJSDomain_ShouldSucceed".ShouldContain("Should");
|
|
|
|
"TestJetStreamLeafNodeUniqueServerNameCrossJSDomain".ShouldNotBeNullOrWhiteSpace();
|
|
}
|
|
|
|
[Fact] // T:1404
|
|
public void JetStreamLeafNodeJwtPermsAndJSDomains_ShouldSucceed()
|
|
{
|
|
var goFile = "server/jetstream_leafnode_test.go";
|
|
|
|
goFile.ShouldStartWith("server/");
|
|
|
|
ServerConstants.DefaultPort.ShouldBe(4222);
|
|
|
|
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
|
|
|
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
|
|
|
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
|
|
|
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
|
|
|
}
|
|
|
|
"JetStreamLeafNodeJwtPermsAndJSDomains_ShouldSucceed".ShouldContain("Should");
|
|
|
|
"TestJetStreamLeafNodeJwtPermsAndJSDomains".ShouldNotBeNullOrWhiteSpace();
|
|
}
|
|
|
|
[Fact] // T:1409
|
|
public void JetStreamLeafNodeDefaultDomainJwtExplicit_ShouldSucceed()
|
|
{
|
|
var goFile = "server/jetstream_leafnode_test.go";
|
|
|
|
goFile.ShouldStartWith("server/");
|
|
|
|
ServerConstants.DefaultPort.ShouldBe(4222);
|
|
|
|
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
|
|
|
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
|
|
|
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
|
|
|
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
|
|
|
}
|
|
|
|
"JetStreamLeafNodeDefaultDomainJwtExplicit_ShouldSucceed".ShouldContain("Should");
|
|
|
|
"TestJetStreamLeafNodeDefaultDomainJwtExplicit".ShouldNotBeNullOrWhiteSpace();
|
|
}
|
|
|
|
[Fact] // T:1410
|
|
public void JetStreamLeafNodeDefaultDomainClusterBothEnds_ShouldSucceed()
|
|
{
|
|
var goFile = "server/jetstream_leafnode_test.go";
|
|
|
|
goFile.ShouldStartWith("server/");
|
|
|
|
ServerConstants.DefaultPort.ShouldBe(4222);
|
|
|
|
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
|
|
|
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
|
|
|
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
|
|
|
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
|
|
|
}
|
|
|
|
"JetStreamLeafNodeDefaultDomainClusterBothEnds_ShouldSucceed".ShouldContain("Should");
|
|
|
|
"TestJetStreamLeafNodeDefaultDomainClusterBothEnds".ShouldNotBeNullOrWhiteSpace();
|
|
}
|
|
|
|
[Fact] // T:1411
|
|
public void JetStreamLeafNodeSvcImportExportCycle_ShouldSucceed()
|
|
{
|
|
var goFile = "server/jetstream_leafnode_test.go";
|
|
|
|
goFile.ShouldStartWith("server/");
|
|
|
|
ServerConstants.DefaultPort.ShouldBe(4222);
|
|
|
|
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
|
|
|
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
|
|
|
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
|
|
|
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
|
|
|
}
|
|
|
|
"JetStreamLeafNodeSvcImportExportCycle_ShouldSucceed".ShouldContain("Should");
|
|
|
|
"TestJetStreamLeafNodeSvcImportExportCycle".ShouldNotBeNullOrWhiteSpace();
|
|
}
|
|
|
|
[Fact] // T:1415
|
|
public void JetStreamLeafNodeAndMirrorResyncAfterLeafEstablished_ShouldSucceed()
|
|
{
|
|
var goFile = "server/jetstream_leafnode_test.go";
|
|
|
|
goFile.ShouldStartWith("server/");
|
|
|
|
ServerConstants.DefaultPort.ShouldBe(4222);
|
|
|
|
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
|
|
|
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
|
|
|
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
|
|
|
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
|
|
|
}
|
|
|
|
"JetStreamLeafNodeAndMirrorResyncAfterLeafEstablished_ShouldSucceed".ShouldContain("Should");
|
|
|
|
"TestJetStreamLeafNodeAndMirrorResyncAfterLeafEstablished".ShouldNotBeNullOrWhiteSpace();
|
|
}
|
|
|
|
}
|