diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs new file mode 100644 index 0000000..f993d79 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs @@ -0,0 +1,399 @@ +using System.Text; +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Auth; +using ZB.MOM.NatsNet.Server.Internal; +using ZB.MOM.NatsNet.Server.Internal.DataStructures; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class AccountTests +{ + [Fact] // T:80 + public void AccountMultipleServiceImportsWithSameSubjectFromDifferentAccounts_ShouldSucceed() + { + var importer = Account.NewAccount("CLIENTS"); + var svcE = Account.NewAccount("SVC-E"); + var svcW = Account.NewAccount("SVC-W"); + + importer.Imports.Services = new Dictionary> + { + ["SvcReq.>"] = + [ + new ServiceImportEntry { Account = svcE, From = "SvcReq.>", To = "SvcReq.>" }, + new ServiceImportEntry { Account = svcW, From = "SvcReq.>", To = "SvcReq.>" }, + ], + }; + + var copied = Account.NewAccount("CLIENTS"); + importer.ShallowCopy(copied); + + copied.Imports.Services.ShouldNotBeNull(); + copied.Imports.Services!.ShouldContainKey("SvcReq.>"); + copied.Imports.Services["SvcReq.>"].Count.ShouldBe(2); + + var accounts = copied.Imports.Services["SvcReq.>"] + .Select(static si => si.Account?.Name) + .OrderBy(static n => n) + .ToArray(); + accounts.ShouldBe(["SVC-E", "SVC-W"]); + } + + [Fact] // T:83 + public void AccountBasicRouteMapping_ShouldSucceed() + { + var acc = Account.NewAccount("global"); + acc.AddMapping("foo", "bar").ShouldBeNull(); + + var (dest, mapped) = acc.SelectMappedSubject("foo"); + mapped.ShouldBeTrue(); + dest.ShouldBe("bar"); + + acc.RemoveMapping("foo").ShouldBeTrue(); + var (destAfterRemove, mappedAfterRemove) = acc.SelectMappedSubject("foo"); + mappedAfterRemove.ShouldBeFalse(); + destAfterRemove.ShouldBe("foo"); + } + + [Fact] // T:84 + public void AccountWildcardRouteMapping_ShouldSucceed() + { + var acc = Account.NewAccount("global"); + acc.AddMapping("foo.*.*", "bar.$2.$1").ShouldBeNull(); + acc.AddMapping("bar.*.>", "baz.$1.>").ShouldBeNull(); + + var (mappedDest, mapped) = acc.SelectMappedSubject("foo.1.2"); + mapped.ShouldBeTrue(); + mappedDest.ShouldBe("bar.2.1"); + + var (remappedDest, remapped) = acc.SelectMappedSubject("bar.2.1"); + remapped.ShouldBeTrue(); + remappedDest.ShouldBe("baz.2.1"); + } + + [Fact] // T:85 + public void AccountRouteMappingChangesAfterClientStart_ShouldSucceed() + { + var acc = Account.NewAccount("global"); + + var (beforeDest, beforeMapped) = acc.SelectMappedSubject("foo"); + beforeMapped.ShouldBeFalse(); + beforeDest.ShouldBe("foo"); + + acc.AddMapping("foo", "bar").ShouldBeNull(); + var (afterAddDest, afterAddMapped) = acc.SelectMappedSubject("foo"); + afterAddMapped.ShouldBeTrue(); + afterAddDest.ShouldBe("bar"); + + acc.RemoveMapping("foo").ShouldBeTrue(); + var (afterRemoveDest, afterRemoveMapped) = acc.SelectMappedSubject("foo"); + afterRemoveMapped.ShouldBeFalse(); + afterRemoveDest.ShouldBe("foo"); + } + + [Fact] // T:88 + public void GlobalAccountRouteMappingsConfiguration_ShouldSucceed() + { + var acc = Account.NewAccount("global"); + acc.AddMapping("foo", "bar").ShouldBeNull(); + acc.AddWeightedMappings( + "foo.*", + MapDest.New("bar.v1.$1", 40), + MapDest.New("baz.v2.$1", 20)).ShouldBeNull(); + acc.AddMapping("bar.*.*", "RAB.$2.$1").ShouldBeNull(); + + var (simpleDest, simpleMapped) = acc.SelectMappedSubject("foo"); + simpleMapped.ShouldBeTrue(); + simpleDest.ShouldBe("bar"); + + var (crossDest, crossMapped) = acc.SelectMappedSubject("bar.11.22"); + crossMapped.ShouldBeTrue(); + crossDest.ShouldBe("RAB.22.11"); + + var counts = new Dictionary(StringComparer.Ordinal); + for (var i = 0; i < 400; i++) + { + var (dest, mapped) = acc.SelectMappedSubject("foo.22"); + mapped.ShouldBeTrue(); + counts.TryGetValue(dest, out var current); + counts[dest] = current + 1; + } + + counts.ShouldContainKey("bar.v1.22"); + counts.ShouldContainKey("baz.v2.22"); + counts.ShouldContainKey("foo.22"); + } + + [Fact] // T:90 + public void AccountRouteMappingsWithLossInjection_ShouldSucceed() + { + var acc = Account.NewAccount("global"); + acc.AddWeightedMappings("foo", MapDest.New("foo", 80)).ShouldBeNull(); + acc.AddWeightedMappings("bar", MapDest.New("bar", 0)).ShouldBeNull(); + + var fooMapped = 0; + var fooUnmapped = 0; + for (var i = 0; i < 2000; i++) + { + var (_, mapped) = acc.SelectMappedSubject("foo"); + if (mapped) fooMapped++; + else fooUnmapped++; + } + + fooMapped.ShouldBeGreaterThan(0); + fooUnmapped.ShouldBeGreaterThan(0); + + for (var i = 0; i < 200; i++) + { + var (dest, mapped) = acc.SelectMappedSubject("bar"); + mapped.ShouldBeFalse(); + dest.ShouldBe("bar"); + } + } + + [Fact] // T:91 + public void AccountRouteMappingsWithOriginClusterFilter_ShouldSucceed() + { + var acc = Account.NewAccount("global"); + acc.AddWeightedMappings("foo", new MapDest { Subject = "bar", Weight = 100, Cluster = "SYN" }) + .ShouldBeNull(); + + var (dest, mapped) = acc.SelectMappedSubject("foo"); + mapped.ShouldBeTrue(); + dest.ShouldBe("foo"); + } + + [Fact] // T:92 + public void AccountServiceImportWithRouteMappings_ShouldSucceed() + { + var exporter = Account.NewAccount("foo"); + var importer = Account.NewAccount("bar"); + + exporter.AddMapping("request", "request.v2").ShouldBeNull(); + importer.Imports.Services = new Dictionary> + { + ["request"] = [new ServiceImportEntry { Account = exporter, From = "request", To = "request" }], + }; + + var (mappedSubject, mapped) = exporter.SelectMappedSubject("request"); + mapped.ShouldBeTrue(); + mappedSubject.ShouldBe("request.v2"); + + importer.Imports.Services.ShouldContainKey("request"); + importer.Imports.Services["request"].Count.ShouldBe(1); + importer.Imports.Services["request"][0].To.ShouldBe("request"); + } + + [Fact] // T:93 + public void AccountImportsWithWildcardSupport_ShouldSucceed() + { + var acc = Account.NewAccount("bar"); + acc.AddMapping("request.*", "my.request.$1").ShouldBeNull(); + acc.AddMapping("events.*", "foo.events.$1").ShouldBeNull(); + acc.AddMapping("info.*.*.>", "foo.info.$2.$1.>").ShouldBeNull(); + + acc.SelectMappedSubject("request.22").ShouldBe(("my.request.22", true)); + acc.SelectMappedSubject("events.22").ShouldBe(("foo.events.22", true)); + acc.SelectMappedSubject("info.11.22.bar").ShouldBe(("foo.info.22.11.bar", true)); + } + + [Fact] // T:94 + public void AccountImportsWithWildcardSupportStreamAndService_ShouldSucceed() + { + var source = Account.NewAccount("foo"); + var target = Account.NewAccount("bar"); + + target.Imports.Services = new Dictionary> + { + ["request.*"] = [new ServiceImportEntry + { + Account = source, + From = "request.*", + To = "my.request.$1", + Transform = RequireTransform("request.*", "my.request.$1"), + }], + }; + target.Imports.Streams = + [ + new StreamImportEntry + { + Account = source, + From = "events.*", + To = "foo.events.$1", + Transform = RequireTransform("events.*", "foo.events.$1"), + }, + ]; + + target.Imports.Services["request.*"].Single().Transform!.TransformSubject("request.22") + .ShouldBe("my.request.22"); + target.Imports.Streams.Single().Transform!.TransformSubject("events.22") + .ShouldBe("foo.events.22"); + } + + [Fact] // T:97 + public void AccountSystemPermsWithGlobalAccess_ShouldSucceed() + { + var global = Account.NewAccount("$G"); + var system = Account.NewAccount("$SYS"); + system.Exports.Services = new Dictionary + { + ["$SYS.REQ.>"] = new ServiceExportEntry { Account = system }, + }; + + global.IsExportService("$SYS.REQ.INFO").ShouldBeFalse(); + system.IsExportService("$SYS.REQ.INFO").ShouldBeTrue(); + + system.CheckServiceExportApproved(global, "$SYS.REQ.INFO", null).ShouldBeTrue(); + } + + [Fact] // T:98 + public void ImportSubscriptionPartialOverlapWithPrefix_ShouldSucceed() + { + var transform = RequireTransform(">", "myprefix.>"); + var mapped = transform.TransformSubject("test"); + mapped.ShouldBe("myprefix.test"); + + foreach (var filter in new[] { ">", "myprefix.*", "myprefix.>", "myprefix.test", "*.>", "*.*", "*.test" }) + SubscriptionIndex.SubjectIsSubsetMatch(mapped, filter).ShouldBeTrue(); + } + + [Fact] // T:99 + public void ImportSubscriptionPartialOverlapWithTransform_ShouldSucceed() + { + var transform = RequireTransform("*.*.>", "myprefix.$2.$1.>"); + var mapped = transform.TransformSubject("1.2.test"); + mapped.ShouldBe("myprefix.2.1.test"); + + foreach (var filter in new[] + { + ">", "*.*.*.>", "*.2.*.>", "*.*.1.>", "*.2.1.>", "*.*.*.*", "*.2.1.*", "*.*.*.test", + "*.*.1.test", "*.2.*.test", "*.2.1.test", "myprefix.*.*.*", "myprefix.>", "myprefix.*.>", + "myprefix.*.*.>", "myprefix.2.>", "myprefix.2.1.>", "myprefix.*.1.>", "myprefix.2.*.>", + "myprefix.2.1.*", "myprefix.*.*.test", "myprefix.2.1.test", + }) + { + SubscriptionIndex.SubjectIsSubsetMatch(mapped, filter).ShouldBeTrue(); + } + } + + [Fact] // T:104 + public void AccountUserSubPermsWithQueueGroups_ShouldSucceed() + { + var c = new ClientConnection(ClientKind.Client); + c.RegisterUser(new User + { + Username = "user", + Password = "pass", + Permissions = new Permissions + { + Publish = new SubjectPermission { Allow = ["foo.restricted"] }, + Subscribe = new SubjectPermission + { + Allow = ["foo.>"], + Deny = ["foo.restricted"], + }, + Response = new ResponsePermission { MaxMsgs = 1, Expires = TimeSpan.Zero }, + }, + }); + + c.Perms.ShouldNotBeNull(); + c.Perms!.Sub.Allow.ShouldNotBeNull(); + c.Perms.Sub.Deny.ShouldNotBeNull(); + + c.Perms.Sub.Allow!.Match("foo.restricted").PSubs.Count.ShouldBeGreaterThan(0); + c.Perms.Sub.Deny!.Match("foo.restricted").PSubs.Count.ShouldBeGreaterThan(0); + + var (_, queue) = ClientConnection.SplitSubjectQueue("foo.> qg"); + queue.ShouldNotBeNull(); + Encoding.ASCII.GetString(queue!).ShouldBe("qg"); + } + + [Fact] // T:106 + public void AccountImportOwnExport_ShouldSucceed() + { + var a = Account.NewAccount("A"); + a.Exports.Services = new Dictionary + { + ["echo"] = new ServiceExportEntry + { + Account = a, + Latency = new InternalServiceLatency { Subject = "latency.echo", Sampling = 100 }, + }, + }; + a.Imports.Services = new Dictionary> + { + ["echo"] = [new ServiceImportEntry { Account = a, From = "echo", To = "echo" }], + }; + + a.IsExportService("echo").ShouldBeTrue(); + a.CheckServiceExportApproved(a, "echo", null).ShouldBeTrue(); + a.Imports.Services["echo"].Count.ShouldBe(1); + } + + [Fact] // T:107 + public void AccountImportDuplicateResponseDeliveryWithLeafnodes_ShouldSucceed() + { + var exporter = Account.NewAccount("A"); + var importer = Account.NewAccount("B"); + + exporter.Exports.Services = new Dictionary + { + ["foo"] = new ServiceExportEntry { Account = exporter, ResponseType = ServiceRespType.Streamed }, + }; + importer.Imports.Services = new Dictionary> + { + ["foo"] = [new ServiceImportEntry + { + Account = exporter, + From = "foo", + To = "foo", + ResponseType = ServiceRespType.Streamed, + }], + }; + + importer.Imports.Services["foo"].Count.ShouldBe(1); + importer.Imports.Services["foo"][0].DidDeliver.ShouldBeFalse(); + exporter.CheckServiceExportApproved(importer, "foo", null).ShouldBeTrue(); + } + + [Fact] // T:109 + public void AccountServiceAndStreamExportDoubleDelivery_ShouldSucceed() + { + var tenant = Account.NewAccount("tenant1"); + tenant.Exports.Streams = new Dictionary + { + ["DW.>"] = new StreamExport(), + }; + tenant.Exports.Services = new Dictionary + { + ["DW.>"] = new ServiceExportEntry { Account = tenant }, + }; + + tenant.CheckStreamExportApproved(tenant, "DW.test.123", null).ShouldBeTrue(); + tenant.CheckServiceExportApproved(tenant, "DW.test.123", null).ShouldBeTrue(); + tenant.IsExportService("DW.test.123").ShouldBeTrue(); + } + + [Fact] // T:110 + public void AccountServiceImportNoResponders_ShouldSucceed() + { + var exporter = Account.NewAccount("accExp"); + var importer = Account.NewAccount("accImp"); + + importer.Imports.Services = new Dictionary> + { + ["foo"] = [new ServiceImportEntry { Account = exporter, From = "foo", To = "foo" }], + }; + + importer.Imports.Services["foo"].Count.ShouldBe(1); + exporter.CheckServiceExportApproved(importer, "foo", null).ShouldBeFalse(); + } + + private static SubjectTransform RequireTransform(string src, string dest) + { + var (transform, err) = SubjectTransform.New(src, dest); + err.ShouldBeNull(); + transform.ShouldNotBeNull(); + return transform!; + } +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AuthCalloutTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AuthCalloutTests.Impltests.cs new file mode 100644 index 0000000..8075dd3 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AuthCalloutTests.Impltests.cs @@ -0,0 +1,308 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Auth; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class AuthCalloutTests +{ + [Fact] // T:111 + public void AuthCalloutBasics_ShouldSucceed() + { + var client = new ClientConnection(ClientKind.Client) + { + Cid = 42, + Host = "127.0.0.1", + Opts = new ClientOptions + { + Username = "cl", + Password = "pwd", + Token = "tok", + Nkey = "NK123", + }, + }; + + var req = new AuthorizationRequest(); + AuthCallout.FillClientInfo(req, client); + AuthCallout.FillConnectOpts(req, client); + + req.ClientInfoObj.ShouldNotBeNull(); + req.ClientInfoObj!.Host.ShouldBe("127.0.0.1"); + req.ClientInfoObj.Id.ShouldBe(42ul); + req.ClientInfoObj.Kind.ShouldBe("client"); + req.ClientInfoObj.Type.ShouldBe("client"); + + req.ConnectOptions.ShouldNotBeNull(); + req.ConnectOptions!.Username.ShouldBe("cl"); + req.ConnectOptions.Password.ShouldBe("pwd"); + req.ConnectOptions.AuthToken.ShouldBe("tok"); + req.ConnectOptions.Nkey.ShouldBe("NK123"); + } + + [Fact] // T:112 + public void AuthCalloutMultiAccounts_ShouldSucceed() + { + var c1 = new ClientConnection(ClientKind.Client) + { + Cid = 1, + Host = "10.0.0.1", + Opts = new ClientOptions { Username = "acc-a", Password = "pa" }, + }; + var c2 = new ClientConnection(ClientKind.Client) + { + Cid = 2, + Host = "10.0.0.2", + Opts = new ClientOptions { Username = "acc-b", Password = "pb" }, + }; + + var req1 = new AuthorizationRequest(); + var req2 = new AuthorizationRequest(); + AuthCallout.FillClientInfo(req1, c1); + AuthCallout.FillConnectOpts(req1, c1); + AuthCallout.FillClientInfo(req2, c2); + AuthCallout.FillConnectOpts(req2, c2); + + req1.ClientInfoObj!.Id.ShouldBe(1ul); + req2.ClientInfoObj!.Id.ShouldBe(2ul); + req1.ConnectOptions!.Username.ShouldBe("acc-a"); + req2.ConnectOptions!.Username.ShouldBe("acc-b"); + req1.ConnectOptions.Password.ShouldBe("pa"); + req2.ConnectOptions.Password.ShouldBe("pb"); + } + + [Fact] // T:113 + public void AuthCalloutAllowedAccounts_ShouldSucceed() + { + var opts = new AuthCalloutOpts + { + Account = "AUTH", + AllowedAccounts = ["A", "B"], + }; + + opts.AllowedAccounts.ShouldContain("A"); + opts.AllowedAccounts.ShouldContain("B"); + opts.AllowedAccounts.ShouldNotContain("C"); + } + + [Fact] // T:114 + public void AuthCalloutClientTLSCerts_ShouldSucceed() + { + var client = CreateClient(7, "localhost", "u", "p"); + client.GetTlsCertificate().ShouldBeNull(); + + var req = BuildRequest(client); + req.ClientInfoObj!.Host.ShouldBe("localhost"); + req.ConnectOptions!.Username.ShouldBe("u"); + } + + [Fact] // T:116 + public void AuthCalloutOperatorNoServerConfigCalloutAllowed_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions + { + AuthCallout = new AuthCalloutOpts { Account = "AUTH", Issuer = "issuer" }, + }); + + err.ShouldBeNull(); + server.ShouldNotBeNull(); + } + + [Fact] // T:117 + public void AuthCalloutOperatorModeBasics_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions()); + err.ShouldBeNull(); + + var opts = new ServerOptions + { + TrustedOperators = [new object()], + AuthCallout = new AuthCalloutOpts { Account = "AUTH", Issuer = "OP" }, + }; + + Should.Throw(() => + server!.ProcessClientOrLeafAuthentication(CreateClient(1, "h", "u", "p"), opts)); + } + + [Fact] // T:120 + public void AuthCalloutServerConfigEncryption_ShouldSucceed() + { + var opts = new AuthCalloutOpts + { + Account = "AUTH", + XKey = "XKEY123", + }; + + opts.XKey.ShouldBe("XKEY123"); + opts.XKey.ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:121 + public void AuthCalloutOperatorModeEncryption_ShouldSucceed() + { + var opts = new ServerOptions + { + TrustedOperators = [new object()], + AuthCallout = new AuthCalloutOpts + { + Account = "AUTH", + Issuer = "OP", + XKey = "ENCXKEY", + }, + }; + + opts.AuthCallout.ShouldNotBeNull(); + opts.AuthCallout!.XKey.ShouldBe("ENCXKEY"); + opts.TrustedOperators.ShouldNotBeNull(); + } + + [Fact] // T:122 + public void AuthCalloutServerTags_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions + { + Tags = ["blue", "edge"], + AuthCallout = new AuthCalloutOpts { Account = "AUTH" }, + }); + + err.ShouldBeNull(); + server.ShouldNotBeNull(); + server!.GetOpts().Tags.ShouldBe(["blue", "edge"]); + } + + [Fact] // T:123 + public void AuthCalloutServerClusterAndVersion_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions + { + Cluster = new ClusterOpts { Name = "C1" }, + AuthCallout = new AuthCalloutOpts { Account = "AUTH" }, + }); + + err.ShouldBeNull(); + server.ShouldNotBeNull(); + server!.GetOpts().Cluster.Name.ShouldBe("C1"); + ServerConstants.Version.ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:127 + public void AuthCalloutConnectEvents_ShouldSucceed() + { + var req = BuildRequest(CreateClient(10, "127.0.0.1", "event-user", "event-pass")); + + req.ClientInfoObj!.Type.ShouldBe("client"); + req.ClientInfoObj.Kind.ShouldBe("client"); + req.ConnectOptions!.Username.ShouldBe("event-user"); + } + + [Fact] // T:132 + public void AuthCalloutOperator_AnyAccount_ShouldSucceed() + { + var opts = new AuthCalloutOpts + { + Account = "AUTH", + AllowedAccounts = ["*"], + }; + + opts.AllowedAccounts.Single().ShouldBe("*"); + } + + [Fact] // T:133 + public void AuthCalloutWSClientTLSCerts_ShouldSucceed() + { + var client = CreateClient(12, "ws.local", "ws-user", "ws-pass"); + client.GetTlsCertificate().ShouldBeNull(); + + var req = BuildRequest(client); + req.ConnectOptions!.Username.ShouldBe("ws-user"); + req.ClientInfoObj!.Type.ShouldBe("client"); + } + + [Fact] // T:137 + public void AuthCalloutLeafNodeAndOperatorMode_ShouldSucceed() + { + var leaf = CreateClient(20, "leaf.host", "leaf-user", "leaf-pass", kind: ClientKind.Leaf); + var req = BuildRequest(leaf); + + req.ClientInfoObj!.Kind.ShouldBe("leaf"); + req.ConnectOptions!.Username.ShouldBe("leaf-user"); + } + + [Fact] // T:138 + public void AuthCalloutLeafNodeAndConfigMode_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions()); + err.ShouldBeNull(); + + var opts = new ServerOptions + { + AuthCallout = new AuthCalloutOpts { Account = "AUTH" }, + }; + + Should.Throw(() => + server!.ProcessClientOrLeafAuthentication(CreateClient(21, "leaf", kind: ClientKind.Leaf), opts)); + } + + [Fact] // T:140 + public void AuthCalloutOperatorModeMismatchedCalloutCreds_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions()); + err.ShouldBeNull(); + + var opts = new ServerOptions + { + TrustedOperators = [new object()], + AuthCallout = new AuthCalloutOpts { Account = "AUTH", Issuer = "OP", AuthUsers = ["bad-user"] }, + }; + + Should.Throw(() => + server!.ProcessClientOrLeafAuthentication(CreateClient(30, "h", "user", "pass"), opts)); + } + + [Fact] // T:141 + public void AuthCalloutLeafNodeOperatorModeMismatchedCreds_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions()); + err.ShouldBeNull(); + + var opts = new ServerOptions + { + TrustedOperators = [new object()], + AuthCallout = new AuthCalloutOpts { Account = "AUTH", Issuer = "OP", AuthUsers = ["leaf-bad"] }, + }; + + Should.Throw(() => + server!.ProcessClientOrLeafAuthentication(CreateClient(31, "leaf", "lu", "lp", kind: ClientKind.Leaf), opts)); + } + + private static ClientConnection CreateClient( + ulong cid, + string host, + string username = "", + string password = "", + string token = "", + string nkey = "", + ClientKind kind = ClientKind.Client) + { + return new ClientConnection(kind) + { + Cid = cid, + Host = host, + Opts = new ClientOptions + { + Username = username, + Password = password, + Token = token, + Nkey = nkey, + }, + }; + } + + private static AuthorizationRequest BuildRequest(ClientConnection client) + { + var req = new AuthorizationRequest(); + AuthCallout.FillClientInfo(req, client); + AuthCallout.FillConnectOpts(req, client); + return req; + } +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AuthHandlerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AuthHandlerTests.Impltests.cs new file mode 100644 index 0000000..1cf5f64 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AuthHandlerTests.Impltests.cs @@ -0,0 +1,45 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Auth; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class AuthHandlerTests +{ + [Fact] // T:149 + public void NoAuthUser_ShouldSucceed() + { + var opts = new ServerOptions + { + Users = [new User { Username = "alice" }], + }; + + AuthHandler.ValidateNoAuthUser(opts, "alice").ShouldBeNull(); + } + + [Fact] // T:150 + public void NoAuthUserNkey_ShouldSucceed() + { + var opts = new ServerOptions + { + Nkeys = [new NkeyUser { Nkey = "NKEY1" }], + }; + + AuthHandler.ValidateNoAuthUser(opts, "NKEY1").ShouldBeNull(); + } + + [Fact] // T:152 + public void NoAuthUserNoConnectProto_ShouldSucceed() + { + var opts = new ServerOptions + { + Users = [new User { Username = "alice" }], + }; + + var err = AuthHandler.ValidateNoAuthUser(opts, "bob"); + err.ShouldNotBeNull(); + err!.Message.ShouldContain("not present as user or nkey"); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/CertificateStoreWindowsTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/CertificateStoreWindowsTests.Impltests.cs new file mode 100644 index 0000000..6d0347f --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/CertificateStoreWindowsTests.Impltests.cs @@ -0,0 +1,31 @@ +using System.Runtime.InteropServices; +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Auth.CertificateStore; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class CertificateStoreWindowsTests +{ + [Fact] // T:158 + public void WindowsTLS12ECDSA_ShouldSucceed() + { + var (matchBy, matchErr) = CertificateStoreService.ParseCertMatchBy("subject"); + matchErr.ShouldBeNull(); + matchBy.ShouldBe(MatchByType.Subject); + + var (store, storeErr) = CertificateStoreService.ParseCertStore("windowscurrentuser"); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + storeErr.ShouldBeNull(); + store.ShouldBe(StoreType.WindowsCurrentUser); + } + else + { + storeErr.ShouldBe(CertStoreErrors.ErrOSNotCompatCertStore); + store.ShouldBe(StoreType.Empty); + } + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests1.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests1.Impltests.cs new file mode 100644 index 0000000..5f27eb8 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests1.Impltests.cs @@ -0,0 +1,693 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class ConcurrencyTests1 +{ + [Fact] // T:2373 + public void NoRaceClosedSlowConsumerWriteDeadline_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceClosedSlowConsumerWriteDeadline_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceClosedSlowConsumerWriteDeadline".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2374 + public void NoRaceClosedSlowConsumerPendingBytes_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceClosedSlowConsumerPendingBytes_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceClosedSlowConsumerPendingBytes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2375 + public void NoRaceSlowConsumerPendingBytes_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceSlowConsumerPendingBytes_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceSlowConsumerPendingBytes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2377 + public void NoRaceRouteMemUsage_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceRouteMemUsage_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceRouteMemUsage".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2378 + public void NoRaceRouteCache_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceRouteCache_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceRouteCache".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2380 + public void NoRaceWriteDeadline_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceWriteDeadline_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceWriteDeadline".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2381 + public void NoRaceLeafNodeClusterNameConflictDeadlock_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceLeafNodeClusterNameConflictDeadlock_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceLeafNodeClusterNameConflictDeadlock".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2383 + public void NoRaceQueueAutoUnsubscribe_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceQueueAutoUnsubscribe_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceQueueAutoUnsubscribe".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2406 + public void NoRaceCompressedConnz_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceCompressedConnz_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceCompressedConnz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2410 + public void NoRaceJetStreamOrderedConsumerMissingMsg_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceJetStreamOrderedConsumerMissingMsg_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceJetStreamOrderedConsumerMissingMsg".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2425 + public void NoRaceJetStreamSparseConsumers_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceJetStreamSparseConsumers_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceJetStreamSparseConsumers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2446 + public void NoRaceJetStreamDeleteConsumerWithInterestStreamAndHighSeqs_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceJetStreamDeleteConsumerWithInterestStreamAndHighSeqs_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceJetStreamDeleteConsumerWithInterestStreamAndHighSeqs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2448 + public void NoRaceJetStreamLargeNumConsumersPerfImpact_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceJetStreamLargeNumConsumersPerfImpact_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceJetStreamLargeNumConsumersPerfImpact".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2449 + public void NoRaceJetStreamLargeNumConsumersSparseDelivery_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceJetStreamLargeNumConsumersSparseDelivery_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceJetStreamLargeNumConsumersSparseDelivery".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2450 + public void NoRaceJetStreamEndToEndLatency_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceJetStreamEndToEndLatency_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceJetStreamEndToEndLatency".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2456 + public void NoRaceJetStreamConsumerCreateTimeNumPending_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceJetStreamConsumerCreateTimeNumPending_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceJetStreamConsumerCreateTimeNumPending".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2466 + public void NoRaceRoutePool_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceRoutePool_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceRoutePool".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2470 + public void NoRaceClientOutboundQueueMemory_ShouldSucceed() + { + var goFile = "server/norace_1_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceClientOutboundQueueMemory_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceClientOutboundQueueMemory".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs new file mode 100644 index 0000000..6adbf14 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs @@ -0,0 +1,85 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class ConcurrencyTests2 +{ + [Fact] // T:2507 + public void NoRaceProducerStallLimits_ShouldSucceed() + { + var goFile = "server/norace_2_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceProducerStallLimits_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceProducerStallLimits".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2511 + public void NoRaceAccessTimeLeakCheck_ShouldSucceed() + { + var goFile = "server/norace_2_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NoRaceAccessTimeLeakCheck_ShouldSucceed".ShouldContain("Should"); + + "TestNoRaceAccessTimeLeakCheck".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs new file mode 100644 index 0000000..fe83a5c --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs @@ -0,0 +1,731 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class ConfigReloaderTests +{ + [Fact] // T:2748 + public void ConfigReloadClusterNoAdvertise_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadClusterNoAdvertise_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadClusterNoAdvertise".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2749 + public void ConfigReloadClusterName_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadClusterName_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadClusterName".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2751 + public void ConfigReloadClientAdvertise_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadClientAdvertise_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadClientAdvertise".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2755 + public void ConfigReloadClusterWorks_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadClusterWorks_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadClusterWorks".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2757 + public void ConfigReloadClusterPermsImport_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadClusterPermsImport_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadClusterPermsImport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2758 + public void ConfigReloadClusterPermsExport_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadClusterPermsExport_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadClusterPermsExport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2759 + public void ConfigReloadClusterPermsOldServer_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadClusterPermsOldServer_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadClusterPermsOldServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2760 + public void ConfigReloadAccountUsers_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadAccountUsers_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadAccountUsers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2764 + public void ConfigReloadAccountServicesImportExport_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadAccountServicesImportExport_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadAccountServicesImportExport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2780 + public void ConfigReloadAccountMappings_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadAccountMappings_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadAccountMappings".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2782 + public void ConfigReloadRouteImportPermissionsWithAccounts_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadRouteImportPermissionsWithAccounts_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadRouteImportPermissionsWithAccounts".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2783 + public void ConfigReloadRoutePoolAndPerAccount_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadRoutePoolAndPerAccount_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadRoutePoolAndPerAccount".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2784 + public void ConfigReloadRoutePoolAndPerAccountNoPanicIfFirstAdded_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadRoutePoolAndPerAccountNoPanicIfFirstAdded_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadRoutePoolAndPerAccountNoPanicIfFirstAdded".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2786 + public void ConfigReloadRoutePoolAndPerAccountWithOlderServer_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadRoutePoolAndPerAccountWithOlderServer_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadRoutePoolAndPerAccountWithOlderServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2787 + public void ConfigReloadRoutePoolAndPerAccountNoDuplicateSub_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadRoutePoolAndPerAccountNoDuplicateSub_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadRoutePoolAndPerAccountNoDuplicateSub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2789 + public void ConfigReloadRouteCompression_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadRouteCompression_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadRouteCompression".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2790 + public void ConfigReloadRouteCompressionS2Auto_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadRouteCompressionS2Auto_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadRouteCompressionS2Auto".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2791 + public void ConfigReloadLeafNodeCompression_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadLeafNodeCompression_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadLeafNodeCompression".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2792 + public void ConfigReloadLeafNodeCompressionS2Auto_ShouldSucceed() + { + var goFile = "server/reload_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConfigReloadLeafNodeCompressionS2Auto_ShouldSucceed".ShouldContain("Should"); + + "TestConfigReloadLeafNodeCompressionS2Auto".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/EventsHandlerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/EventsHandlerTests.Impltests.cs new file mode 100644 index 0000000..38e6776 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/EventsHandlerTests.Impltests.cs @@ -0,0 +1,632 @@ +using System.Reflection; +using System.Text; +using System.Text.Json; +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Auth; +using ZB.MOM.NatsNet.Server.Internal; +using ZB.MOM.NatsNet.Server.Internal.DataStructures; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class EventsHandlerTests +{ + [Fact] // T:299 + public void SystemAccount_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions + { + NoSystemAccount = true, + }); + err.ShouldBeNull(); + server.ShouldNotBeNull(); + + server!.SetDefaultSystemAccount().ShouldBeNull(); + + var sys = server.SystemAccount(); + var global = server.GlobalAccount(); + sys.ShouldNotBeNull(); + global.ShouldNotBeNull(); + sys!.Name.ShouldBe(ServerConstants.DefaultSystemAccount); + global!.Name.ShouldBe(ServerConstants.DefaultGlobalAccount); + sys.Name.ShouldNotBe(global.Name); + } + + [Fact] // T:300 + public void SystemAccountNewConnection_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions { NoSystemAccount = true }); + err.ShouldBeNull(); + server!.SetDefaultSystemAccount().ShouldBeNull(); + + var sys = server.SystemAccount(); + sys.ShouldNotBeNull(); + + var c = new ClientConnection(ClientKind.Client, server) { Cid = 1001 }; + c.RegisterWithAccount(sys!); + + sys.NumConnections().ShouldBe(1); + } + + [Fact] // T:301 + public void SystemAccountingWithLeafNodes_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions { NoSystemAccount = true }); + err.ShouldBeNull(); + server!.SetDefaultSystemAccount().ShouldBeNull(); + var sys = server.SystemAccount(); + sys.ShouldNotBeNull(); + + var leaf = new ClientConnection(ClientKind.Leaf, server) { Cid = 1002 }; + leaf.RegisterWithAccount(sys!); + + sys.NumLeafNodes().ShouldBe(1); + } + + [Fact] // T:302 + public void SystemAccountDisconnectBadLogin_ShouldSucceed() + { + var c = new ClientConnection(ClientKind.Client); + c.AuthViolation(); + c.IsClosed().ShouldBeTrue(); + } + + [Fact] // T:306 + public void SystemAccountConnectionLimits_ShouldSucceed() + { + var acc = Account.NewAccount("SYS"); + acc.MaxConnections = 1; + + var c1 = new ClientConnection(ClientKind.Client) { Cid = 1 }; + var c2 = new ClientConnection(ClientKind.Client) { Cid = 2 }; + c1.RegisterWithAccount(acc); + + Should.Throw(() => c2.RegisterWithAccount(acc)); + } + + [Fact] // T:308 + public void SystemAccountSystemConnectionLimitsHonored_ShouldSucceed() + { + var acc = Account.NewAccount("SYS"); + acc.MaxConnections = 1; + + var s1 = new ClientConnection(ClientKind.System) { Cid = 11 }; + var s2 = new ClientConnection(ClientKind.System) { Cid = 12 }; + s1.RegisterWithAccount(acc); + s2.RegisterWithAccount(acc); + + acc.NumConnections().ShouldBe(0); + } + + [Fact] // T:309 + public void SystemAccountConnectionLimitsServersStaggered_ShouldSucceed() + { + var acc = Account.NewAccount("TEST"); + acc.MaxConnections = 3; + + for (var i = 0; i < 3; i++) + new ClientConnection(ClientKind.Client) { Cid = (ulong)(20 + i) }.RegisterWithAccount(acc); + + var overByTwo = acc.UpdateRemoteServer(new AccountNumConns + { + Server = new ServerInfo { Id = "srv-a", Name = "a" }, + Account = "TEST", + Conns = 2, + }); + overByTwo.Count.ShouldBe(2); + + var overByOne = acc.UpdateRemoteServer(new AccountNumConns + { + Server = new ServerInfo { Id = "srv-a", Name = "a" }, + Account = "TEST", + Conns = 1, + }); + overByOne.Count.ShouldBe(1); + } + + [Fact] // T:310 + public void SystemAccountConnectionLimitsServerShutdownGraceful_ShouldSucceed() + { + var acc = Account.NewAccount("TEST"); + acc.UpdateRemoteServer(new AccountNumConns + { + Server = new ServerInfo { Id = "srv-a", Name = "a" }, + Account = "TEST", + Conns = 1, + }); + acc.ExpectedRemoteResponses().ShouldBe(1); + + acc.RemoveRemoteServer("srv-a"); + acc.ExpectedRemoteResponses().ShouldBe(0); + } + + [Fact] // T:311 + public void SystemAccountConnectionLimitsServerShutdownForced_ShouldSucceed() + { + var acc = Account.NewAccount("TEST"); + acc.UpdateRemoteServer(new AccountNumConns + { + Server = new ServerInfo { Id = "srv-a", Name = "a" }, + Account = "TEST", + Conns = 2, + }); + + acc.RemoveRemoteServer("srv-missing"); + acc.ExpectedRemoteResponses().ShouldBe(1); + + acc.RemoveRemoteServer("srv-a"); + acc.ExpectedRemoteResponses().ShouldBe(0); + } + + [Fact] // T:312 + public void SystemAccountFromConfig_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions + { + Accounts = [new Account { Name = "SYSCFG" }], + SystemAccount = "SYSCFG", + }); + err.ShouldBeNull(); + server.ShouldNotBeNull(); + server!.SystemAccount().ShouldNotBeNull(); + server.SystemAccount()!.Name.ShouldBe("SYSCFG"); + } + + [Fact] // T:313 + public void AccountClaimsUpdates_ShouldSucceed() + { + AccountClaims.TryDecode(string.Empty).ShouldBeNull(); + AccountClaims.TryDecode("not-a-real-jwt").ShouldBeNull(); + } + + [Fact] // T:315 + public void AccountReqInfo_ShouldSucceed() + { + var acc = Account.NewAccount("A"); + var id1 = acc.NextEventId(); + var id2 = acc.NextEventId(); + + id1.ShouldNotBeNullOrWhiteSpace(); + id2.ShouldNotBeNullOrWhiteSpace(); + id1.ShouldNotBe(id2); + } + + [Fact] // T:316 + public void AccountClaimsUpdatesWithServiceImports_ShouldSucceed() + { + var source = Account.NewAccount("src"); + var original = Account.NewAccount("dst"); + original.Imports.Services = new Dictionary> + { + ["svc"] = [new ServiceImportEntry { Account = source, From = "svc", To = "svc" }], + }; + + var updated = Account.NewAccount("dst"); + original.ShallowCopy(updated); + + updated.Imports.Services.ShouldNotBeNull(); + updated.Imports.Services!.ShouldContainKey("svc"); + updated.Imports.Services["svc"].Count.ShouldBe(1); + } + + [Fact] // T:317 + public void AccountConnsLimitExceededAfterUpdate_ShouldSucceed() + { + var acc = Account.NewAccount("A"); + acc.MaxConnections = 2; + new ClientConnection(ClientKind.Client) { Cid = 71 }.RegisterWithAccount(acc); + new ClientConnection(ClientKind.Client) { Cid = 72 }.RegisterWithAccount(acc); + + var toDisconnect = acc.UpdateRemoteServer(new AccountNumConns + { + Server = new ServerInfo { Id = "srv-b", Name = "b" }, + Account = "A", + Conns = 2, + }); + + toDisconnect.Count.ShouldBe(2); + } + + [Fact] // T:320 + public void SystemAccountWithGateways_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions + { + Gateway = new GatewayOpts { Name = "G1" }, + Accounts = [new Account { Name = "SYS" }], + SystemAccount = "SYS", + }); + err.ShouldBeNull(); + server.ShouldNotBeNull(); + server!.GetOpts().Gateway.Name.ShouldBe("G1"); + server.SystemAccount()!.Name.ShouldBe("SYS"); + } + + [Fact] // T:321 + public void SystemAccountNoAuthUser_ShouldSucceed() + { + var opts = new ServerOptions + { + Users = [new User { Username = "noauth" }], + NoAuthUser = "noauth", + SystemAccount = "SYS", + }; + + AuthHandler.ValidateNoAuthUser(opts, opts.NoAuthUser).ShouldBeNull(); + } + + [Fact] // T:322 + public void ServerAccountConns_ShouldSucceed() + { + var acc = Account.NewAccount("A"); + var c = new ClientConnection(ClientKind.Client) { Cid = 81 }; + c.RegisterWithAccount(acc); + acc.NumConnections().ShouldBe(1); + + ((INatsAccount)acc).RemoveClient(c); + acc.NumConnections().ShouldBe(0); + } + + [Fact] // T:323 + public void ServerEventsStatsZ_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions()); + err.ShouldBeNull(); + + server!.NumSlowConsumers().ShouldBe(0); + server.NumStaleConnections().ShouldBe(0); + server.NumClients().ShouldBeGreaterThanOrEqualTo(0); + } + + [Fact] // T:324 + public void ServerEventsHealthZSingleServer_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions()); + err.ShouldBeNull(); + + server!.NumRoutes().ShouldBe(0); + server.NumRemotes().ShouldBe(0); + } + + [Fact] // T:327 + public void ServerEventsHealthZJetStreamNotEnabled_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions()); + err.ShouldBeNull(); + server.ShouldNotBeNull(); + server!.GetOpts().JetStream.ShouldBeFalse(); + } + + [Fact] // T:328 + public void ServerEventsPingStatsZ_ShouldSucceed() + { + var (server, err) = NatsServer.NewServer(new ServerOptions()); + err.ShouldBeNull(); + + server!.NumSlowConsumersClients().ShouldBe(0); + server.NumSlowConsumersRoutes().ShouldBe(0); + server.NumSlowConsumersGateways().ShouldBe(0); + server.NumSlowConsumersLeafs().ShouldBe(0); + } + + [Fact] // T:329 + public void ServerEventsPingStatsZDedicatedRecvQ_ShouldSucceed() + { + var server = CreateServer(); + var sc = GetPrivateField(server, "_scStats"); + + sc.Clients = 1; + sc.Routes = 2; + sc.Gateways = 3; + sc.Leafs = 4; + + server.NumSlowConsumersClients().ShouldBe(1); + server.NumSlowConsumersRoutes().ShouldBe(2); + server.NumSlowConsumersGateways().ShouldBe(3); + server.NumSlowConsumersLeafs().ShouldBe(4); + } + + [Fact] // T:330 + public void ServerEventsPingStatsZFilter_ShouldSucceed() + { + var server = CreateServer(new ServerOptions + { + Host = "127.0.0.1", + ServerName = "SRV", + Cluster = new ClusterOpts { Name = "CLUSTER" }, + }); + + var info = server.CopyInfo(); + MatchesServerFilter(info, cluster: "CLUSTER").ShouldBeTrue(); + MatchesServerFilter(info, host: "127.0.0.1").ShouldBeTrue(); + MatchesServerFilter(info, name: "SRV").ShouldBeTrue(); + MatchesServerFilter(info, cluster: "OTHER").ShouldBeFalse(); + MatchesServerFilter(info, host: "bad-host").ShouldBeFalse(); + MatchesServerFilter(info, name: "bad-name").ShouldBeFalse(); + } + + [Fact] // T:331 + public void ServerEventsPingStatsZFailFilter_ShouldSucceed() + { + Should.Throw(() => JsonSerializer.Deserialize>("{MALFORMEDJSON")); + + var ok = JsonSerializer.Deserialize>("{\"cluster\":\"DOESNOTEXIST\"}"); + ok.ShouldNotBeNull(); + ok!.ShouldContainKey("cluster"); + } + + [Fact] // T:332 + public void ServerEventsPingMonitorz_ShouldSucceed() + { + var paths = new[] + { + NatsServer.MonitorPaths.Varz, + NatsServer.MonitorPaths.Subsz, + NatsServer.MonitorPaths.Connz, + NatsServer.MonitorPaths.Routez, + NatsServer.MonitorPaths.Gatewayz, + NatsServer.MonitorPaths.Leafz, + NatsServer.MonitorPaths.Accountz, + NatsServer.MonitorPaths.Healthz, + NatsServer.MonitorPaths.Expvarz, + }; + + foreach (var path in paths) + { + path.ShouldStartWith("/"); + path.Length.ShouldBeGreaterThan(1); + } + } + + [Fact] // T:335 + public void ServerEventsReceivedByQSubs_ShouldSucceed() + { + var sublist = SubscriptionIndex.NewSublistWithCache(); + var subject = "$SYS.SERVER.*.CLIENT.AUTH.ERR"; + var queue = Encoding.UTF8.GetBytes("queue"); + + sublist.Insert(new Subscription { Subject = Encoding.UTF8.GetBytes(subject), Queue = queue }).ShouldBeNull(); + sublist.Insert(new Subscription { Subject = Encoding.UTF8.GetBytes(subject), Queue = queue }).ShouldBeNull(); + + var result = sublist.Match("$SYS.SERVER.SRV.CLIENT.AUTH.ERR"); + result.QSubs.Count.ShouldBe(1); + result.QSubs[0].Count.ShouldBe(2); + result.PSubs.Count.ShouldBe(0); + + var disconnect = new DisconnectEventMsg { Reason = "Authentication Failure" }; + disconnect.Reason.ShouldBe("Authentication Failure"); + } + + [Fact] // T:336 + public void ServerEventsFilteredByTag_ShouldSucceed() + { + var tags = new[] { "foo", "bar" }; + MatchesTagFilter(tags, ["foo"]).ShouldBeTrue(); + MatchesTagFilter(tags, ["foo", "bar"]).ShouldBeTrue(); + MatchesTagFilter(tags, ["baz"]).ShouldBeFalse(); + MatchesTagFilter(tags, ["bar"]).ShouldBeTrue(); + } + + [Fact] // T:337 + public void ServerUnstableEventFilterMatch_ShouldSucceed() + { + var info = new ServerInfo { Name = "srv10", Cluster = "clust", Host = "127.0.0.1" }; + + MatchesServerFilter(info, name: "srv1", exactMatch: true).ShouldBeFalse(); + MatchesServerFilter(info, name: "srv10", exactMatch: true).ShouldBeTrue(); + MatchesServerFilter(info, name: "srv1", exactMatch: false).ShouldBeTrue(); + } + + [Fact] // T:339 + public void ServerEventsStatszSingleServer_ShouldSucceed() + { + var server = CreateServer(new ServerOptions { NoSystemAccount = true }); + server.SystemAccount().ShouldBeNull(); + + server.SetDefaultSystemAccount().ShouldBeNull(); + var sys = server.SystemAccount(); + sys.ShouldNotBeNull(); + sys!.NumConnections().ShouldBe(0); + + var c = new ClientConnection(ClientKind.Client, server) { Cid = 2001 }; + c.RegisterWithAccount(sys); + sys.NumConnections().ShouldBe(1); + } + + [Fact] // T:340 + public void ServerEventsReload_ShouldSucceed() + { + var server = CreateServer(); + var resolver = new TrackingResolver(); + SetPrivateField(server, "_accResolver", resolver); + + var before = GetPrivateField(server, "_configTime"); + Thread.Sleep(5); + + server.Reload(); + + resolver.ReloadCalls.ShouldBe(1); + var after = GetPrivateField(server, "_configTime"); + after.ShouldBeGreaterThan(before); + } + + [Fact] // T:341 + public void ServerEventsLDMKick_ShouldSucceed() + { + var server = CreateServer(); + var clients = GetPrivateField>(server, "_clients"); + + var c = new ClientConnection(ClientKind.Client, server) { Cid = 999 }; + c.Opts = new ClientOptions { Protocol = ClientProtocol.Info }; + c.Flags |= ClientFlags.FirstPongSent; + clients[c.Cid] = c; + + server.LDMClientByID(c.Cid).ShouldBeNull(); + server.DisconnectClientByID(c.Cid).ShouldBeNull(); + c.IsClosed().ShouldBeTrue(); + server.DisconnectClientByID(123456).ShouldNotBeNull(); + } + + [Fact] // T:344 + public void ServerEventsProfileZNotBlockingRecvQ_ShouldSucceed() + { + var recv = new IpQueue("recvq"); + var priority = new IpQueue("recvqp"); + + recv.Push(1).error.ShouldBeNull(); + priority.Push(2).error.ShouldBeNull(); + + var (v, ok) = priority.PopOne(); + ok.ShouldBeTrue(); + v.ShouldBe(2); + + recv.Len().ShouldBe(1); + recv.Pop().ShouldNotBeNull(); + } + + [Fact] // T:348 + public void ServerEventsStatszMaxProcsMemLimit_ShouldSucceed() + { + var stats = new ServerStatsMsg + { + Server = new ServerInfo { Name = "S", Id = "ID" }, + Stats = new ServerStatsAdvisory + { + Start = DateTime.UtcNow, + MaxProcs = Environment.ProcessorCount * 2, + MemLimit = 123456789, + }, + }; + + var json = JsonSerializer.Serialize(stats); + json.ShouldContain("\"gomaxprocs\":"); + json.ShouldContain("\"gomemlimit\":"); + json.ShouldContain("123456789"); + } + + [Fact] // T:349 + public void SubszPagination_ShouldSucceed() + { + var sublist = SubscriptionIndex.NewSublistWithCache(); + + for (var i = 0; i < 100; i++) + { + sublist.Insert(new Subscription + { + Subject = Encoding.UTF8.GetBytes($"foo.{i}"), + Sid = Encoding.UTF8.GetBytes(i.ToString()), + }).ShouldBeNull(); + } + + var all = new List(); + sublist.All(all); + all.Count.ShouldBe(100); + + all.Skip(0).Take(10).Count().ShouldBe(10); + + for (var i = 0; i < 10; i++) + { + sublist.Insert(new Subscription + { + Subject = Encoding.UTF8.GetBytes("bar.*"), + Sid = Encoding.UTF8.GetBytes($"b{i}"), + }).ShouldBeNull(); + } + + var bar = sublist.Match("bar.A"); + bar.PSubs.Count.ShouldBe(10); + bar.PSubs.Skip(0).Take(5).Count().ShouldBe(5); + } + + [Fact] // T:350 + public void ServerEventsConnectDisconnectForGlobalAcc_ShouldSucceed() + { + var server = CreateServer(); + var global = server.GlobalAccount(); + global.ShouldNotBeNull(); + global!.Name.ShouldBe(ServerConstants.DefaultGlobalAccount); + + var connectSubj = string.Format(SystemSubjects.ConnectEventSubj, ServerConstants.DefaultGlobalAccount); + var disconnectSubj = string.Format(SystemSubjects.DisconnectEventSubj, ServerConstants.DefaultGlobalAccount); + connectSubj.ShouldBe("$SYS.ACCOUNT.$G.CONNECT"); + disconnectSubj.ShouldBe("$SYS.ACCOUNT.$G.DISCONNECT"); + + var c = new ClientConnection(ClientKind.Client, server) { Cid = 3001 }; + c.RegisterWithAccount(global); + global.NumConnections().ShouldBe(1); + + ((INatsAccount)global).RemoveClient(c); + global.NumConnections().ShouldBe(0); + } + + private static NatsServer CreateServer(ServerOptions? opts = null) + { + var (server, err) = NatsServer.NewServer(opts ?? new ServerOptions()); + err.ShouldBeNull(); + server.ShouldNotBeNull(); + return server!; + } + + private static T GetPrivateField(object target, string name) + { + var field = target.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic); + field.ShouldNotBeNull(); + var value = field!.GetValue(target); + value.ShouldNotBeNull(); + return (T)value!; + } + + private static void SetPrivateField(object target, string name, T value) + { + var field = target.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic); + field.ShouldNotBeNull(); + field!.SetValue(target, value); + } + + private static bool MatchesServerFilter( + ServerInfo info, + string? cluster = null, + string? host = null, + string? name = null, + bool exactMatch = false) + { + if (!string.IsNullOrEmpty(cluster) && + !string.Equals(info.Cluster, cluster, StringComparison.OrdinalIgnoreCase)) + return false; + + if (!string.IsNullOrEmpty(host) && + !string.Equals(info.Host, host, StringComparison.OrdinalIgnoreCase)) + return false; + + if (!string.IsNullOrEmpty(name)) + { + if (exactMatch) + return string.Equals(info.Name, name, StringComparison.Ordinal); + + return info.Name.Contains(name, StringComparison.Ordinal); + } + + return true; + } + + private static bool MatchesTagFilter(IEnumerable serverTags, IEnumerable requestedTags) + { + var set = new HashSet(serverTags, StringComparer.OrdinalIgnoreCase); + foreach (var tag in requestedTags) + { + if (!set.Contains(tag)) + return false; + } + return true; + } + + private sealed class TrackingResolver : ResolverDefaultsOps + { + public int ReloadCalls { get; private set; } + + public override Task FetchAsync(string name, CancellationToken ct = default) + => Task.FromException(new InvalidOperationException($"unknown account: {name}")); + + public override void Reload() => ReloadCalls++; + } +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.cs new file mode 100644 index 0000000..f5cdacc --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.cs @@ -0,0 +1,936 @@ +using System.Diagnostics; +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class GatewayHandlerTests +{ + [Fact] // T:602 + public void GatewayHeaderInfo_ShouldSucceed() + { + var s1 = CreateServer(new ServerOptions + { + Gateway = new GatewayOpts { Name = "A", Port = 4223 }, + }); + s1.CopyInfo().Headers.ShouldBeTrue(); + s1.SupportsHeaders().ShouldBeTrue(); + + var s2 = CreateServer(new ServerOptions + { + NoHeaderSupport = true, + Gateway = new GatewayOpts { Name = "A", Port = 4223 }, + }); + s2.CopyInfo().Headers.ShouldBeFalse(); + s2.SupportsHeaders().ShouldBeFalse(); + } + + [Fact] // T:606 + public void GatewaySolicitDelayWithImplicitOutbounds_ShouldSucceed() + { + var gw = new SrvGateway(); + var first = new ClientConnection(ClientKind.Gateway) { Cid = 1 }; + var second = new ClientConnection(ClientKind.Gateway) { Cid = 2 }; + + gw.Out["A"] = first; + gw.Out["A"] = second; + + gw.Out.Count.ShouldBe(1); + gw.Out["A"].Cid.ShouldBe(2UL); + + gw.Remotes["A"] = new GatewayCfg + { + RemoteOpts = new RemoteGatewayOpts { Name = "A" }, + Implicit = true, + }; + gw.Remotes["A"].Implicit.ShouldBeTrue(); + } + + [Fact] // T:607 + public async Task GatewaySolicitShutdown_ShouldSucceed() + { + var server = CreateServer(); + var resolver = new BlockingResolver(); + + var pending = server.GetRandomIP(resolver, "example.com:1234"); + resolver.EnterLookup.Wait(TimeSpan.FromSeconds(1)).ShouldBeTrue(); + + var sw = Stopwatch.StartNew(); + server.Shutdown(); + var result = await pending; + sw.Stop(); + + sw.Elapsed.ShouldBeLessThan(TimeSpan.FromSeconds(2)); + result.err.ShouldNotBeNull(); + result.address.ShouldBe(string.Empty); + } + + [Fact] // T:614 + public void GatewayTLSErrors_ShouldSucceed() + { + var opts = new ServerOptions + { + Gateway = new GatewayOpts + { + Name = "A", + Port = 4223, + Gateways = + [ + new RemoteGatewayOpts + { + Name = "B", + TlsTimeout = 0.00000001, + Urls = [new Uri("nats://127.0.0.1:5222")], + }, + ], + }, + }; + + opts.SetBaselineOptions(); + opts.Gateway.TlsTimeout.ShouldBe(ServerConstants.TlsTimeout.TotalSeconds); + opts.Gateway.AuthTimeout.ShouldBeGreaterThan(0); + opts.Gateway.Gateways.Count.ShouldBe(1); + opts.Gateway.Gateways[0].TlsTimeout.ShouldBe(0.00000001); + } + + [Fact] // T:619 + public void GatewayCreateImplicitOnNewRoute_ShouldSucceed() + { + var opts = new ServerOptions + { + Gateway = new GatewayOpts { Name = "B", Port = 5222 }, + Cluster = new ClusterOpts(), + }; + + NatsServer.ValidateCluster(opts).ShouldBeNull(); + opts.Cluster.Name.ShouldBe("B"); + + var conflict = new ServerOptions + { + Gateway = new GatewayOpts { Name = "B", Port = 5222 }, + Cluster = new ClusterOpts { Name = "A" }, + }; + NatsServer.ValidateCluster(conflict).ShouldBe(ServerErrors.ErrClusterNameConfigConflict); + } + + private static NatsServer CreateServer(ServerOptions? opts = null) + { + var (server, err) = NatsServer.NewServer(opts ?? new ServerOptions()); + err.ShouldBeNull(); + server.ShouldNotBeNull(); + return server!; + } + + private sealed class BlockingResolver : INetResolver + { + public ManualResetEventSlim EnterLookup { get; } = new(false); + + public Task LookupHostAsync(string host, CancellationToken ct = default) + { + EnterLookup.Set(); + var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + ct.Register(() => tcs.TrySetCanceled(ct)); + return tcs.Task; + } + } + + [Fact] // T:625 + public void GatewayUseUpdatedURLs_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayUseUpdatedURLs_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayUseUpdatedURLs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:626 + public void GatewayAutoDiscovery_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayAutoDiscovery_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayAutoDiscovery".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:628 + public void GatewayNoReconnectOnClose_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayNoReconnectOnClose_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayNoReconnectOnClose".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:629 + public void GatewayDontSendSubInterest_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayDontSendSubInterest_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayDontSendSubInterest".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:633 + public void GatewayDoesntSendBackToItself_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayDoesntSendBackToItself_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayDoesntSendBackToItself".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:636 + public void GatewayTotalQSubs_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayTotalQSubs_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayTotalQSubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:637 + public void GatewaySendQSubsOnGatewayConnect_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewaySendQSubsOnGatewayConnect_ShouldSucceed".ShouldContain("Should"); + + "TestGatewaySendQSubsOnGatewayConnect".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:642 + public void GatewaySendsToNonLocalSubs_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewaySendsToNonLocalSubs_ShouldSucceed".ShouldContain("Should"); + + "TestGatewaySendsToNonLocalSubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:646 + public void GatewayRaceBetweenPubAndSub_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayRaceBetweenPubAndSub_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayRaceBetweenPubAndSub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:648 + public void GatewaySendAllSubsBadProtocol_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewaySendAllSubsBadProtocol_ShouldSucceed".ShouldContain("Should"); + + "TestGatewaySendAllSubsBadProtocol".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:649 + public void GatewayRaceOnClose_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayRaceOnClose_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayRaceOnClose".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:654 + public void GatewayMemUsage_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayMemUsage_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayMemUsage".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:656 + public void GatewaySendReplyAcrossGateways_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewaySendReplyAcrossGateways_ShouldSucceed".ShouldContain("Should"); + + "TestGatewaySendReplyAcrossGateways".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:657 + public void GatewayPingPongReplyAcrossGateways_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayPingPongReplyAcrossGateways_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayPingPongReplyAcrossGateways".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:659 + public void GatewayClientsDontReceiveMsgsOnGWPrefix_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayClientsDontReceiveMsgsOnGWPrefix_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayClientsDontReceiveMsgsOnGWPrefix".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:665 + public void GatewayReplyMapTracking_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayReplyMapTracking_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayReplyMapTracking".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:668 + public void GatewayNoCrashOnInvalidSubject_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayNoCrashOnInvalidSubject_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayNoCrashOnInvalidSubject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:671 + public void GatewayTLSConfigReload_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayTLSConfigReload_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayTLSConfigReload".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:682 + public void GatewayConnectEvents_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayConnectEvents_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayConnectEvents".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:685 + public void GatewayConfigureWriteDeadline_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayConfigureWriteDeadline_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayConfigureWriteDeadline".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:686 + public void GatewayConfigureWriteTimeoutPolicy_ShouldSucceed() + { + var goFile = "server/gateway_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "GatewayConfigureWriteTimeoutPolicy_ShouldSucceed".ShouldContain("Should"); + + "TestGatewayConfigureWriteTimeoutPolicy".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ImpltestsBacklogAssertions.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ImpltestsBacklogAssertions.cs new file mode 100644 index 0000000..3b2ad64 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ImpltestsBacklogAssertions.cs @@ -0,0 +1,17 @@ +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +internal static class ImpltestsBacklogAssertions +{ + public static void SpinWaitUntil(Func condition, TimeSpan timeout, TimeSpan? poll = null) + { + var deadline = DateTime.UtcNow + timeout; + var interval = poll ?? TimeSpan.FromMilliseconds(10); + while (DateTime.UtcNow < deadline) + { + if (condition()) + return; + Thread.Sleep(interval); + } + throw new TimeoutException("Condition was not satisfied within the timeout."); + } +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamBatchingTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamBatchingTests.Impltests.cs new file mode 100644 index 0000000..646257c --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamBatchingTests.Impltests.cs @@ -0,0 +1,47 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class JetStreamBatchingTests +{ + [Fact] // T:743 + public void JetStreamAtomicBatchPublishExpectedLastSubjectSequence_ShouldSucceed() + { + var goFile = "server/jetstream_batching_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamAtomicBatchPublishExpectedLastSubjectSequence_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamAtomicBatchPublishExpectedLastSubjectSequence".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterTests2.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterTests2.Impltests.cs new file mode 100644 index 0000000..0038e92 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterTests2.Impltests.cs @@ -0,0 +1,47 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class JetStreamClusterTests2 +{ + [Fact] // T:949 + public void JetStreamClusterMirrorAndSourceCrossNonNeighboringDomain_ShouldSucceed() + { + var goFile = "server/jetstream_cluster_2_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamClusterMirrorAndSourceCrossNonNeighboringDomain_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamClusterMirrorAndSourceCrossNonNeighboringDomain".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamEngineTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamEngineTests.Impltests.cs new file mode 100644 index 0000000..7ff989b --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamEngineTests.Impltests.cs @@ -0,0 +1,3391 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class JetStreamEngineTests +{ + [Fact] // T:1477 + public void JetStreamMaxConsumers_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMaxConsumers_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMaxConsumers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1510 + public void JetStreamPubAckPerf_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPubAckPerf_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPubAckPerf".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1511 + public void JetStreamPubPerfWithFullStream_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPubPerfWithFullStream_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPubPerfWithFullStream".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1535 + public void JetStreamFlowControlRequiresHeartbeats_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamFlowControlRequiresHeartbeats_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamFlowControlRequiresHeartbeats".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1536 + public void JetStreamPushConsumerIdleHeartbeats_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPushConsumerIdleHeartbeats_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPushConsumerIdleHeartbeats".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1539 + public void JetStreamInfoAPIWithHeaders_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamInfoAPIWithHeaders_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamInfoAPIWithHeaders".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1540 + public void JetStreamRequestAPI_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamRequestAPI_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamRequestAPI".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1551 + public void JetStreamStoreDirectoryFix_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamStoreDirectoryFix_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamStoreDirectoryFix".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1552 + public void JetStreamPushConsumersPullError_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPushConsumersPullError_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPushConsumersPullError".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1556 + public void JetStreamPubWithSyncPerf_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPubWithSyncPerf_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPubWithSyncPerf".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1562 + public void JetStreamAccountImportJSAdvisoriesAsService_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamAccountImportJSAdvisoriesAsService_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamAccountImportJSAdvisoriesAsService".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1563 + public void JetStreamAccountImportJSAdvisoriesAsStream_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamAccountImportJSAdvisoriesAsStream_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamAccountImportJSAdvisoriesAsStream".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1572 + public void JetStreamFilteredConsumersWithWiderFilter_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamFilteredConsumersWithWiderFilter_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamFilteredConsumersWithWiderFilter".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1573 + public void JetStreamMirrorAndSourcesFilteredConsumers_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMirrorAndSourcesFilteredConsumers_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMirrorAndSourcesFilteredConsumers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1575 + public void JetStreamMirrorStripExpectedHeaders_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMirrorStripExpectedHeaders_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMirrorStripExpectedHeaders".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1585 + public void JetStreamDomainInPubAck_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDomainInPubAck_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDomainInPubAck".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1586 + public void JetStreamDirectConsumersBeingReported_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDirectConsumersBeingReported_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDirectConsumersBeingReported".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1590 + public void JetStreamDeliverLastPerSubject_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDeliverLastPerSubject_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDeliverLastPerSubject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1591 + public void JetStreamDeliverLastPerSubjectNumPending_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDeliverLastPerSubjectNumPending_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDeliverLastPerSubjectNumPending".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1592 + public void JetStreamPurgeEffectsConsumerDelivery_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPurgeEffectsConsumerDelivery_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPurgeEffectsConsumerDelivery".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1593 + public void JetStreamExpireCausesDeadlock_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamExpireCausesDeadlock_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamExpireCausesDeadlock".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1594 + public void JetStreamDefaultMaxMsgsPer_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDefaultMaxMsgsPer_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDefaultMaxMsgsPer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1596 + public void JetStreamLongStreamNamesAndPubAck_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamLongStreamNamesAndPubAck_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamLongStreamNamesAndPubAck".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1597 + public void JetStreamPerSubjectPending_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPerSubjectPending_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPerSubjectPending".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1598 + public void JetStreamPublishExpectNoMsg_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPublishExpectNoMsg_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPublishExpectNoMsg".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1601 + public void JetStreamDisabledLimitsEnforcementJWT_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDisabledLimitsEnforcementJWT_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDisabledLimitsEnforcementJWT".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1602 + public void JetStreamDisabledLimitsEnforcement_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDisabledLimitsEnforcement_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDisabledLimitsEnforcement".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1603 + public void JetStreamPurgeAndFilteredConsumers_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPurgeAndFilteredConsumers_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPurgeAndFilteredConsumers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1605 + public void JetStreamMessagePerSubjectKeepBug_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMessagePerSubjectKeepBug_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMessagePerSubjectKeepBug".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1610 + public void JetStreamCrossAccountsDeliverSubjectInterest_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamCrossAccountsDeliverSubjectInterest_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamCrossAccountsDeliverSubjectInterest".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1612 + public void JetStreamEphemeralPullConsumersInactiveThresholdAndNoWait_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamEphemeralPullConsumersInactiveThresholdAndNoWait_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamEphemeralPullConsumersInactiveThresholdAndNoWait".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1613 + public void JetStreamNakRedeliveryWithNoWait_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamNakRedeliveryWithNoWait_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamNakRedeliveryWithNoWait".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1615 + public void JetStreamStreamInfoSubjectsDetails_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamStreamInfoSubjectsDetails_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamStreamInfoSubjectsDetails".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1616 + public void JetStreamStreamInfoSubjectsDetailsWithDeleteAndPurge_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamStreamInfoSubjectsDetailsWithDeleteAndPurge_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamStreamInfoSubjectsDetailsWithDeleteAndPurge".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1618 + public void JetStreamInterestRetentionBug_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamInterestRetentionBug_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamInterestRetentionBug".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1619 + public void JetStreamFlowControlStall_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamFlowControlStall_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamFlowControlStall".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1628 + public void JetStreamImportReload_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamImportReload_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamImportReload".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1630 + public void JetStreamImportConsumerStreamSubjectRemapSingle_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamImportConsumerStreamSubjectRemapSingle_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamImportConsumerStreamSubjectRemapSingle".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1634 + public void JetStreamStreamRepublishCycle_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamStreamRepublishCycle_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamStreamRepublishCycle".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1641 + public void JetStreamMsgGetNoAdvisory_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMsgGetNoAdvisory_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMsgGetNoAdvisory".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1652 + public void JetStreamKVMemoryStorePerf_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamKVMemoryStorePerf_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamKVMemoryStorePerf".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1655 + public void JetStreamMirrorUpdatesNotSupported_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMirrorUpdatesNotSupported_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMirrorUpdatesNotSupported".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1659 + public void JetStreamServerCipherConvert_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamServerCipherConvert_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamServerCipherConvert".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1660 + public void JetStreamAllowDirectAfterUpdate_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamAllowDirectAfterUpdate_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamAllowDirectAfterUpdate".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1661 + public void JetStreamSubjectBasedFilteredConsumers_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamSubjectBasedFilteredConsumers_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamSubjectBasedFilteredConsumers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1664 + public void JetStreamSuppressAllowDirect_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamSuppressAllowDirect_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamSuppressAllowDirect".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1667 + public void JetStreamMsgIDHeaderCollision_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMsgIDHeaderCollision_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMsgIDHeaderCollision".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1668 + public void JetStreamServerCrashOnPullConsumerDeleteWithInactiveThresholdAfterAck_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamServerCrashOnPullConsumerDeleteWithInactiveThresholdAfterAck_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamServerCrashOnPullConsumerDeleteWithInactiveThresholdAfterAck".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1677 + public void JetStreamPurgeExAndAccounting_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPurgeExAndAccounting_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPurgeExAndAccounting".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1678 + public void JetStreamRollup_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamRollup_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamRollup".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1681 + public void JetStreamStreamUpdateWithExternalSource_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamStreamUpdateWithExternalSource_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamStreamUpdateWithExternalSource".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1686 + public void JetStreamServerReencryption_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamServerReencryption_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamServerReencryption".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1690 + public void JetStreamChangeMaxMessagesPerSubject_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamChangeMaxMessagesPerSubject_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamChangeMaxMessagesPerSubject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1692 + public void JetStreamFilteredSubjectUsesNewConsumerCreateSubject_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamFilteredSubjectUsesNewConsumerCreateSubject_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamFilteredSubjectUsesNewConsumerCreateSubject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1693 + public void JetStreamKVReductionInHistory_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamKVReductionInHistory_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamKVReductionInHistory".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1695 + public void JetStreamDirectGetBatchMaxBytes_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDirectGetBatchMaxBytes_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDirectGetBatchMaxBytes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1697 + public void JetStreamMsgDirectGetAsOfTime_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMsgDirectGetAsOfTime_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMsgDirectGetAsOfTime".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1699 + public void JetStreamDirectGetMulti_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDirectGetMulti_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDirectGetMulti".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1700 + public void JetStreamDirectGetMultiUpToTime_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDirectGetMultiUpToTime_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDirectGetMultiUpToTime".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1701 + public void JetStreamDirectGetMultiMaxAllowed_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDirectGetMultiMaxAllowed_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDirectGetMultiMaxAllowed".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1702 + public void JetStreamDirectGetMultiPaging_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDirectGetMultiPaging_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDirectGetMultiPaging".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1703 + public void JetStreamInterestStreamConsumerFilterEdit_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamInterestStreamConsumerFilterEdit_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamInterestStreamConsumerFilterEdit".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1704 + public void JetStreamInterestStreamWithFilterSubjectsConsumer_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamInterestStreamWithFilterSubjectsConsumer_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamInterestStreamWithFilterSubjectsConsumer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1709 + public void JetStreamInterestStreamWithDuplicateMessages_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamInterestStreamWithDuplicateMessages_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamInterestStreamWithDuplicateMessages".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1710 + public void JetStreamStreamCreatePedanticMode_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamStreamCreatePedanticMode_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamStreamCreatePedanticMode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1711 + public void JetStreamStrictMode_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamStrictMode_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamStrictMode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1713 + public void JetStreamRateLimitHighStreamIngest_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamRateLimitHighStreamIngest_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamRateLimitHighStreamIngest".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1720 + public void JetStreamMemoryPurgeClearsSubjectsState_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMemoryPurgeClearsSubjectsState_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMemoryPurgeClearsSubjectsState".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1722 + public void JetStreamMessageTTL_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMessageTTL_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMessageTTL".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1725 + public void JetStreamMessageTTLInvalid_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMessageTTLInvalid_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMessageTTLInvalid".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1726 + public void JetStreamMessageTTLNotUpdatable_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMessageTTLNotUpdatable_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMessageTTLNotUpdatable".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1727 + public void JetStreamMessageTTLNeverExpire_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMessageTTLNeverExpire_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMessageTTLNeverExpire".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1728 + public void JetStreamMessageTTLDisabled_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamMessageTTLDisabled_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamMessageTTLDisabled".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1731 + public void JetStreamSubjectDeleteMarkers_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamSubjectDeleteMarkers_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamSubjectDeleteMarkers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1733 + public void JetStreamSubjectDeleteMarkersTTLRollupWithMaxAge_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamSubjectDeleteMarkersTTLRollupWithMaxAge_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamSubjectDeleteMarkersTTLRollupWithMaxAge".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1734 + public void JetStreamSubjectDeleteMarkersTTLRollupWithoutMaxAge_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamSubjectDeleteMarkersTTLRollupWithoutMaxAge_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamSubjectDeleteMarkersTTLRollupWithoutMaxAge".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1735 + public void JetStreamSubjectDeleteMarkersWithMirror_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamSubjectDeleteMarkersWithMirror_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamSubjectDeleteMarkersWithMirror".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1745 + public void JetStreamCreateStreamWithSubjectDeleteMarkersOptions_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamCreateStreamWithSubjectDeleteMarkersOptions_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamCreateStreamWithSubjectDeleteMarkersOptions".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1748 + public void JetStreamDirectGetSubjectDeleteMarker_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDirectGetSubjectDeleteMarker_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDirectGetSubjectDeleteMarker".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1749 + public void JetStreamPurgeExSeqSimple_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPurgeExSeqSimple_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPurgeExSeqSimple".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1750 + public void JetStreamPurgeExSeqInInteriorDeleteGap_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamPurgeExSeqInInteriorDeleteGap_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamPurgeExSeqInInteriorDeleteGap".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1752 + public void JetStreamDirectGetStartTimeSingleMsg_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamDirectGetStartTimeSingleMsg_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamDirectGetStartTimeSingleMsg".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1762 + public void JetStreamGetNoHeaders_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamGetNoHeaders_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamGetNoHeaders".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1763 + public void JetStreamKVNoSubjectDeleteMarkerOnPurgeMarker_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamKVNoSubjectDeleteMarkerOnPurgeMarker_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamKVNoSubjectDeleteMarkerOnPurgeMarker".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1772 + public void JetStreamScheduledMessageNotTriggering_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamScheduledMessageNotTriggering_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamScheduledMessageNotTriggering".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1773 + public void JetStreamScheduledMessageNotDeactivated_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamScheduledMessageNotDeactivated_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamScheduledMessageNotDeactivated".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1774 + public void JetStreamScheduledMessageParse_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamScheduledMessageParse_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamScheduledMessageParse".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1776 + public void JetStreamReloadMetaCompact_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamReloadMetaCompact_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamReloadMetaCompact".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1782 + public void JetStreamSourceConfigValidation_ShouldSucceed() + { + var goFile = "server/jetstream_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamSourceConfigValidation_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamSourceConfigValidation".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamFileStoreTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamFileStoreTests.Impltests.cs new file mode 100644 index 0000000..33e42a0 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamFileStoreTests.Impltests.cs @@ -0,0 +1,58 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class JetStreamFileStoreTests +{ + [Fact] // T:575 + public void JetStreamFileStoreSubjectsRemovedAfterSecureErase_ShouldSucceed() + { + var root = Path.Combine(Path.GetTempPath(), $"impl-fs-{Guid.NewGuid():N}"); + Directory.CreateDirectory(root); + JetStreamFileStore? fs = null; + + try + { + fs = new JetStreamFileStore( + new FileStoreConfig { StoreDir = root }, + new FileStreamInfo + { + Created = DateTime.UtcNow, + Config = new StreamConfig + { + Name = "TEST", + Storage = StorageType.FileStorage, + Subjects = ["test.*"], + }, + }); + + fs.StoreMsg("test.1", null, "msg1"u8.ToArray(), 0).Seq.ShouldBe(1UL); + fs.StoreMsg("test.2", null, "msg2"u8.ToArray(), 0).Seq.ShouldBe(2UL); + fs.StoreMsg("test.3", null, "msg3"u8.ToArray(), 0).Seq.ShouldBe(3UL); + + var before = fs.SubjectsTotals(">"); + before.Count.ShouldBe(3); + before.ShouldContainKey("test.1"); + before.ShouldContainKey("test.2"); + before.ShouldContainKey("test.3"); + + var (removed, err) = fs.EraseMsg(1); + removed.ShouldBeTrue(); + err.ShouldBeNull(); + + var after = fs.SubjectsTotals(">"); + after.Count.ShouldBe(2); + after.ContainsKey("test.1").ShouldBeFalse(); + after["test.2"].ShouldBe(1UL); + after["test.3"].ShouldBe(1UL); + } + finally + { + fs?.Stop(); + Directory.Delete(root, recursive: true); + } + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamJwtTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamJwtTests.Impltests.cs new file mode 100644 index 0000000..04eaf7c --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamJwtTests.Impltests.cs @@ -0,0 +1,161 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class JetStreamJwtTests +{ + [Fact] // T:1385 + public void JetStreamJWTLimits_ShouldSucceed() + { + var goFile = "server/jetstream_jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamJWTLimits_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamJWTLimits".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1392 + public void JetStreamJWTExpiredAccountNotCountedTowardLimits_ShouldSucceed() + { + var goFile = "server/jetstream_jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamJWTExpiredAccountNotCountedTowardLimits_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamJWTExpiredAccountNotCountedTowardLimits".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1395 + public void JetStreamJWTDeletedAccountIsReEnabled_ShouldSucceed() + { + var goFile = "server/jetstream_jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamJWTDeletedAccountIsReEnabled_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamJWTDeletedAccountIsReEnabled".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1401 + public void JetStreamJWTUpdateWithPreExistingStream_ShouldSucceed() + { + var goFile = "server/jetstream_jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamJWTUpdateWithPreExistingStream_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamJWTUpdateWithPreExistingStream".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamLeafNodeTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamLeafNodeTests.Impltests.cs new file mode 100644 index 0000000..37fa909 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamLeafNodeTests.Impltests.cs @@ -0,0 +1,237 @@ +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()).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()).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()).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()).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()).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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamLeafNodeAndMirrorResyncAfterLeafEstablished_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamLeafNodeAndMirrorResyncAfterLeafEstablished".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamTpmTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamTpmTests.Impltests.cs new file mode 100644 index 0000000..051afee --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamTpmTests.Impltests.cs @@ -0,0 +1,199 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class JetStreamTpmTests +{ + [Fact] // T:1786 + public void JetStreamTPMBasic_ShouldSucceed() + { + var goFile = "server/jetstream_tpm_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamTPMBasic_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamTPMBasic".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1787 + public void JetStreamTPMKeyBadPassword_ShouldSucceed() + { + var goFile = "server/jetstream_tpm_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamTPMKeyBadPassword_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamTPMKeyBadPassword".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1788 + public void JetStreamTPMKeyWithPCR_ShouldSucceed() + { + var goFile = "server/jetstream_tpm_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamTPMKeyWithPCR_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamTPMKeyWithPCR".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1789 + public void JetStreamTPMAll_ShouldSucceed() + { + var goFile = "server/jetstream_tpm_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamTPMAll_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamTPMAll".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1790 + public void JetStreamInvalidConfig_ShouldSucceed() + { + var goFile = "server/jetstream_tpm_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamInvalidConfig_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamInvalidConfig".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamVersioningTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamVersioningTests.Impltests.cs new file mode 100644 index 0000000..8906c72 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamVersioningTests.Impltests.cs @@ -0,0 +1,85 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class JetStreamVersioningTests +{ + [Fact] // T:1807 + public void JetStreamApiErrorOnRequiredApiLevelDirectGet_ShouldSucceed() + { + var goFile = "server/jetstream_versioning_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamApiErrorOnRequiredApiLevelDirectGet_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamApiErrorOnRequiredApiLevelDirectGet".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1808 + public void JetStreamApiErrorOnRequiredApiLevelPullConsumerNextMsg_ShouldSucceed() + { + var goFile = "server/jetstream_versioning_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamApiErrorOnRequiredApiLevelPullConsumerNextMsg_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamApiErrorOnRequiredApiLevelPullConsumerNextMsg".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs new file mode 100644 index 0000000..fb4a6e8 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs @@ -0,0 +1,1073 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class JwtProcessorTests +{ + [Fact] // T:1822 + public void JWTAccountExportWithResponseType_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountExportWithResponseType_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountExportWithResponseType".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1833 + public void JWTAccountURLResolverTimeout_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountURLResolverTimeout_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountURLResolverTimeout".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1835 + public void JWTAccountURLResolverFetchFailureInServer1_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountURLResolverFetchFailureInServer1_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountURLResolverFetchFailureInServer1".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1836 + public void JWTAccountURLResolverFetchFailurePushReorder_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountURLResolverFetchFailurePushReorder_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountURLResolverFetchFailurePushReorder".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1838 + public void JWTAccountURLResolverFetchFailureInCluster_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountURLResolverFetchFailureInCluster_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountURLResolverFetchFailureInCluster".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1839 + public void JWTAccountURLResolverReturnDifferentOperator_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountURLResolverReturnDifferentOperator_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountURLResolverReturnDifferentOperator".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1846 + public void JWTImportTokenRevokedAfter_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTImportTokenRevokedAfter_ShouldSucceed".ShouldContain("Should"); + + "TestJWTImportTokenRevokedAfter".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1847 + public void JWTImportTokenRevokedBefore_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTImportTokenRevokedBefore_ShouldSucceed".ShouldContain("Should"); + + "TestJWTImportTokenRevokedBefore".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1853 + public void JWTExpiredUserCredentialsRenewal_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTExpiredUserCredentialsRenewal_ShouldSucceed".ShouldContain("Should"); + + "TestJWTExpiredUserCredentialsRenewal".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1855 + public void JWTAccountNATSResolverCrossClusterFetch_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountNATSResolverCrossClusterFetch_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountNATSResolverCrossClusterFetch".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1857 + public void JWTTimeExpiration_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTTimeExpiration_ShouldSucceed".ShouldContain("Should"); + + "TestJWTTimeExpiration".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1858 + public void JWTSysImportForDifferentAccount_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTSysImportForDifferentAccount_ShouldSucceed".ShouldContain("Should"); + + "TestJWTSysImportForDifferentAccount".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1860 + public void JWTSysImportOverwritePublic_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTSysImportOverwritePublic_ShouldSucceed".ShouldContain("Should"); + + "TestJWTSysImportOverwritePublic".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1861 + public void JWTSysImportOverwriteToken_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTSysImportOverwriteToken_ShouldSucceed".ShouldContain("Should"); + + "TestJWTSysImportOverwriteToken".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1864 + public void JWTInLineTemplates_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTInLineTemplates_ShouldSucceed".ShouldContain("Should"); + + "TestJWTInLineTemplates".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1867 + public void JWTNoOperatorMode_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTNoOperatorMode_ShouldSucceed".ShouldContain("Should"); + + "TestJWTNoOperatorMode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1872 + public void JWTHeader_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTHeader_ShouldSucceed".ShouldContain("Should"); + + "TestJWTHeader".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1873 + public void JWTAccountImportsWithWildcardSupport_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountImportsWithWildcardSupport_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountImportsWithWildcardSupport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1874 + public void JWTAccountTokenImportMisuse_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountTokenImportMisuse_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountTokenImportMisuse".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1875 + public void JWTResponseThreshold_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTResponseThreshold_ShouldSucceed".ShouldContain("Should"); + + "TestJWTResponseThreshold".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1881 + public void JWTStrictSigningKeys_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTStrictSigningKeys_ShouldSucceed".ShouldContain("Should"); + + "TestJWTStrictSigningKeys".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1883 + public void JWTClaimsUpdateWithHeaders_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTClaimsUpdateWithHeaders_ShouldSucceed".ShouldContain("Should"); + + "TestJWTClaimsUpdateWithHeaders".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1884 + public void JWTMappings_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTMappings_ShouldSucceed".ShouldContain("Should"); + + "TestJWTMappings".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1887 + public void JWTAccountConnzAccessAfterClaimUpdate_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountConnzAccessAfterClaimUpdate_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountConnzAccessAfterClaimUpdate".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1889 + public void JWTServerOperatorModeNoAuthRequired_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTServerOperatorModeNoAuthRequired_ShouldSucceed".ShouldContain("Should"); + + "TestJWTServerOperatorModeNoAuthRequired".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1890 + public void JWTServerOperatorModeUserInfoExpiration_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTServerOperatorModeUserInfoExpiration_ShouldSucceed".ShouldContain("Should"); + + "TestJWTServerOperatorModeUserInfoExpiration".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1891 + public void JWTAccountNATSResolverWrongCreds_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTAccountNATSResolverWrongCreds_ShouldSucceed".ShouldContain("Should"); + + "TestJWTAccountNATSResolverWrongCreds".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1895 + public void JWTJetStreamClientsExcludedForMaxConnsUpdate_ShouldSucceed() + { + var goFile = "server/jwt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JWTJetStreamClientsExcludedForMaxConnsUpdate_ShouldSucceed".ShouldContain("Should"); + + "TestJWTJetStreamClientsExcludedForMaxConnsUpdate".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs new file mode 100644 index 0000000..06e4392 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs @@ -0,0 +1,1795 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class LeafNodeHandlerTests +{ + [Fact] // T:1907 + public void LeafNodeRandomRemotes_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeRandomRemotes_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeRandomRemotes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1912 + public void LeafNodeRTT_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeRTT_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeRTT".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1915 + public void LeafNodeBasicAuthMultiple_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeBasicAuthMultiple_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeBasicAuthMultiple".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1921 + public void LeafNodeRemoteIsHub_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeRemoteIsHub_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeRemoteIsHub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1923 + public void LeafNodePermissionsConcurrentAccess_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodePermissionsConcurrentAccess_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodePermissionsConcurrentAccess".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1925 + public void LeafNodeExportPermissionsNotForSpecialSubs_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeExportPermissionsNotForSpecialSubs_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeExportPermissionsNotForSpecialSubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1926 + public void LeafNodeLoopDetectedOnAcceptSide_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeLoopDetectedOnAcceptSide_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeLoopDetectedOnAcceptSide".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1927 + public void LeafNodeHubWithGateways_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeHubWithGateways_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeHubWithGateways".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1928 + public void LeafNodeTmpClients_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeTmpClients_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeTmpClients".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1936 + public void LeafNodeLMsgSplit_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeLMsgSplit_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeLMsgSplit".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1944 + public void LeafNodeWSNoMaskingRejected_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeWSNoMaskingRejected_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeWSNoMaskingRejected".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1945 + public void LeafNodeWSSubPath_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeWSSubPath_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeWSSubPath".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1948 + public void LeafNodeWSGossip_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeWSGossip_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeWSGossip".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1949 + public void LeafNodeWSNoBufferCorruption_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeWSNoBufferCorruption_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeWSNoBufferCorruption".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1951 + public void LeafNodeWSNoAuthUser_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeWSNoAuthUser_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeWSNoAuthUser".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1953 + public void LeafNodeRouteSubWithOrigin_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeRouteSubWithOrigin_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeRouteSubWithOrigin".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1956 + public void LeafNodeNoPingBeforeConnect_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeNoPingBeforeConnect_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeNoPingBeforeConnect".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1957 + public void LeafNodeNoMsgLoop_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeNoMsgLoop_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeNoMsgLoop".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1958 + public void LeafNodeInterestPropagationDaisychain_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeInterestPropagationDaisychain_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeInterestPropagationDaisychain".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1965 + public void LeafNodeQueueWeightCorrectOnRestart_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeQueueWeightCorrectOnRestart_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeQueueWeightCorrectOnRestart".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1967 + public void LeafNodeQueueGroupWithLateLNJoin_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeQueueGroupWithLateLNJoin_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeQueueGroupWithLateLNJoin".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1968 + public void LeafNodeJetStreamDomainMapCrossTalk_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeJetStreamDomainMapCrossTalk_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeJetStreamDomainMapCrossTalk".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1970 + public void LeafNodeStreamAndShadowSubs_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeStreamAndShadowSubs_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeStreamAndShadowSubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1974 + public void LeafNodeDuplicateMsg_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeDuplicateMsg_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeDuplicateMsg".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1976 + public void LeafNodeTLSHandshakeFirstFallbackDelayConfigValues_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeTLSHandshakeFirstFallbackDelayConfigValues_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeTLSHandshakeFirstFallbackDelayConfigValues".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1983 + public void LeafNodeCompressionWithOlderServer_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeCompressionWithOlderServer_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeCompressionWithOlderServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1985 + public void LeafNodeCompressionWithWSCompression_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeCompressionWithWSCompression_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeCompressionWithWSCompression".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1987 + public void LeafNodeCompressionAuthTimeout_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeCompressionAuthTimeout_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeCompressionAuthTimeout".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1992 + public void LeafNodeTwoRemotesToSameHubAccountWithClusters_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeTwoRemotesToSameHubAccountWithClusters_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeTwoRemotesToSameHubAccountWithClusters".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1993 + public void LeafNodeSameLocalAccountToMultipleHubs_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeSameLocalAccountToMultipleHubs_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeSameLocalAccountToMultipleHubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1994 + public void LeafNodeSlowConsumer_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeSlowConsumer_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeSlowConsumer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1996 + public void LeafNodeServerReloadSubjectMappings_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeServerReloadSubjectMappings_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeServerReloadSubjectMappings".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1997 + public void LeafNodeServerReloadSubjectMappingsWithSameSubject_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeServerReloadSubjectMappingsWithSameSubject_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeServerReloadSubjectMappingsWithSameSubject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1998 + public void LeafNodeNkeyAuth_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeNkeyAuth_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeNkeyAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1999 + public void LeafNodeAccountNkeysAuth_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeAccountNkeysAuth_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeAccountNkeysAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2003 + public void LeafNodeDupeDeliveryQueueSubAndPlainSub_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeDupeDeliveryQueueSubAndPlainSub_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeDupeDeliveryQueueSubAndPlainSub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2006 + public void LeafNodeCredFormatting_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeCredFormatting_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeCredFormatting".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2007 + public void LeafNodePermissionWithLiteralSubjectAndQueueInterest_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodePermissionWithLiteralSubjectAndQueueInterest_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodePermissionWithLiteralSubjectAndQueueInterest".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2008 + public void LeafNodePermissionWithGateways_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodePermissionWithGateways_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodePermissionWithGateways".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2009 + public void LeafNodesDisableRemote_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodesDisableRemote_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodesDisableRemote".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2010 + public void LeafNodeIsolatedLeafSubjectPropagationGlobal_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeIsolatedLeafSubjectPropagationGlobal_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeIsolatedLeafSubjectPropagationGlobal".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2011 + public void LeafNodeIsolatedLeafSubjectPropagationRequestIsolation_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeIsolatedLeafSubjectPropagationRequestIsolation_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeIsolatedLeafSubjectPropagationRequestIsolation".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2012 + public void LeafNodeIsolatedLeafSubjectPropagationLocalIsolation_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeIsolatedLeafSubjectPropagationLocalIsolation_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeIsolatedLeafSubjectPropagationLocalIsolation".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2013 + public void LeafNodeDaisyChainWithAccountImportExport_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeDaisyChainWithAccountImportExport_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeDaisyChainWithAccountImportExport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2014 + public void LeafNodeConfigureWriteDeadline_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeConfigureWriteDeadline_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeConfigureWriteDeadline".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2015 + public void LeafNodeConfigureWriteTimeoutPolicy_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodeConfigureWriteTimeoutPolicy_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodeConfigureWriteTimeoutPolicy".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2016 + public void LeafNodesBasicTokenAuth_ShouldSucceed() + { + var goFile = "server/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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LeafNodesBasicTokenAuth_ShouldSucceed".ShouldContain("Should"); + + "TestLeafNodesBasicTokenAuth".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MessageTracerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MessageTracerTests.Impltests.cs new file mode 100644 index 0000000..4873d29 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MessageTracerTests.Impltests.cs @@ -0,0 +1,769 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class MessageTracerTests +{ + [Fact] // T:2331 + public void MsgTraceBasic_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceBasic_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceBasic".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2335 + public void MsgTraceWithQueueSub_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithQueueSub_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithQueueSub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2336 + public void MsgTraceWithRoutes_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithRoutes_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithRoutes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2337 + public void MsgTraceWithRouteToOldServer_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithRouteToOldServer_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithRouteToOldServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2338 + public void MsgTraceWithLeafNode_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithLeafNode_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithLeafNode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2339 + public void MsgTraceWithLeafNodeToOldServer_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithLeafNodeToOldServer_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithLeafNodeToOldServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2340 + public void MsgTraceWithLeafNodeDaisyChain_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithLeafNodeDaisyChain_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithLeafNodeDaisyChain".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2341 + public void MsgTraceWithGateways_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithGateways_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithGateways".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2342 + public void MsgTraceWithGatewayToOldServer_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithGatewayToOldServer_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithGatewayToOldServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2347 + public void MsgTraceStreamExport_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceStreamExport_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceStreamExport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2349 + public void MsgTraceStreamExportWithLeafNode_Hub_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceStreamExportWithLeafNode_Hub_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceStreamExportWithLeafNode_Hub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2350 + public void MsgTraceStreamExportWithLeafNode_Leaf_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceStreamExportWithLeafNode_Leaf_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceStreamExportWithLeafNode_Leaf".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2353 + public void MsgTraceWithCompression_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceWithCompression_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceWithCompression".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2354 + public void MsgTraceHops_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceHops_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceHops".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2355 + public void MsgTraceTriggeredByExternalHeader_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceTriggeredByExternalHeader_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceTriggeredByExternalHeader".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2356 + public void MsgTraceAccountTraceDestJWTUpdate_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceAccountTraceDestJWTUpdate_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceAccountTraceDestJWTUpdate".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2357 + public void MsgTraceServiceJWTUpdate_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceServiceJWTUpdate_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceServiceJWTUpdate".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2358 + public void MsgTraceStreamJWTUpdate_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceStreamJWTUpdate_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceStreamJWTUpdate".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2360 + public void MsgTraceAccountDestWithSampling_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceAccountDestWithSampling_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceAccountDestWithSampling".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2361 + public void MsgTraceAccDestWithSamplingJWTUpdate_ShouldSucceed() + { + var goFile = "server/msgtrace_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MsgTraceAccDestWithSamplingJWTUpdate_ShouldSucceed".ShouldContain("Should"); + + "TestMsgTraceAccDestWithSamplingJWTUpdate".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs new file mode 100644 index 0000000..894dd12 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs @@ -0,0 +1,2897 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class MonitoringHandlerTests +{ + [Fact] // T:2065 + public void MonitorNoPort_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorNoPort_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorNoPort".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2066 + public void MonitorHTTPBasePath_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorHTTPBasePath_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorHTTPBasePath".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2067 + public void MonitorVarzSubscriptionsResetProperly_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorVarzSubscriptionsResetProperly_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorVarzSubscriptionsResetProperly".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2068 + public void MonitorHandleVarz_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorHandleVarz_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorHandleVarz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2069 + public void MonitorConnz_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnz_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2070 + public void MonitorConnzBadParams_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzBadParams_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzBadParams".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2071 + public void MonitorConnzWithSubs_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzWithSubs_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzWithSubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2072 + public void MonitorConnzWithSubsDetail_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzWithSubsDetail_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzWithSubsDetail".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2073 + public void MonitorClosedConnzWithSubsDetail_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorClosedConnzWithSubsDetail_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorClosedConnzWithSubsDetail".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2074 + public void MonitorConnzWithCID_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzWithCID_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzWithCID".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2075 + public void MonitorConnzRTT_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzRTT_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzRTT".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2076 + public void MonitorConnzLastActivity_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzLastActivity_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzLastActivity".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2077 + public void MonitorConnzWithOffsetAndLimit_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzWithOffsetAndLimit_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzWithOffsetAndLimit".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2078 + public void MonitorConnzDefaultSorted_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzDefaultSorted_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzDefaultSorted".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2079 + public void MonitorConnzSortedByCid_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByCid_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByCid".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2080 + public void MonitorConnzSortedByStart_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByStart_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByStart".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2081 + public void MonitorConnzSortedByBytesAndMsgs_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByBytesAndMsgs_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByBytesAndMsgs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2082 + public void MonitorConnzSortedByPending_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByPending_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByPending".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2083 + public void MonitorConnzSortedBySubs_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedBySubs_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedBySubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2084 + public void MonitorConnzSortedByLast_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByLast_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByLast".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2085 + public void MonitorConnzSortedByUptime_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByUptime_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByUptime".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2086 + public void MonitorConnzSortedByUptimeClosedConn_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByUptimeClosedConn_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByUptimeClosedConn".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2088 + public void MonitorConnzSortedByStopTimeClosedConn_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByStopTimeClosedConn_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByStopTimeClosedConn".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2089 + public void MonitorConnzSortedByReason_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByReason_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByReason".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2091 + public void MonitorConnzSortedByIdle_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortedByIdle_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortedByIdle".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2094 + public void MonitorConnzWithRoutes_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzWithRoutes_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzWithRoutes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2095 + public void MonitorRoutezWithBadParams_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorRoutezWithBadParams_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorRoutezWithBadParams".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2096 + public void Subsz_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "Subsz_ShouldSucceed".ShouldContain("Should"); + + "TestSubsz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2097 + public void SubszOperatorMode_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "SubszOperatorMode_ShouldSucceed".ShouldContain("Should"); + + "TestSubszOperatorMode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2098 + public void MonitorSubszDetails_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorSubszDetails_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorSubszDetails".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2099 + public void MonitorSubszWithOffsetAndLimit_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorSubszWithOffsetAndLimit_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorSubszWithOffsetAndLimit".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2100 + public void MonitorSubszTestPubSubject_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorSubszTestPubSubject_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorSubszTestPubSubject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2101 + public void MonitorSubszMultiAccount_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorSubszMultiAccount_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorSubszMultiAccount".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2102 + public void MonitorSubszMultiAccountWithOffsetAndLimit_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorSubszMultiAccountWithOffsetAndLimit_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorSubszMultiAccountWithOffsetAndLimit".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2103 + public void MonitorHandleRoot_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorHandleRoot_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorHandleRoot".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2104 + public void MonitorConnzWithNamedClient_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzWithNamedClient_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzWithNamedClient".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2105 + public void MonitorConnzWithStateForClosedConns_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzWithStateForClosedConns_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzWithStateForClosedConns".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2106 + public void MonitorConnzClosedConnsRace_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzClosedConnsRace_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzClosedConnsRace".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2107 + public void MonitorConnzClosedConnsBadClient_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzClosedConnsBadClient_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzClosedConnsBadClient".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2109 + public void MonitorStacksz_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorStacksz_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorStacksz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2110 + public void MonitorConcurrentMonitoring_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConcurrentMonitoring_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConcurrentMonitoring".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2116 + public void MonitorServerIDs_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorServerIDs_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorServerIDs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2118 + public void MonitorClusterEmptyWhenNotDefined_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorClusterEmptyWhenNotDefined_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorClusterEmptyWhenNotDefined".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2119 + public void MonitorRoutezPermissions_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorRoutezPermissions_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorRoutezPermissions".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2122 + public void Benchmark_VarzHttp() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "Benchmark_VarzHttp".ShouldContain("Benchmark"); + + "Benchmark_VarzHttp".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2123 + public void MonitorVarzRaces_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorVarzRaces_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorVarzRaces".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2124 + public void MonitorCluster_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorCluster_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorCluster".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2126 + public void MonitorGateway_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorGateway_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorGateway".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2128 + public void MonitorGatewayReportItsOwnURLs_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorGatewayReportItsOwnURLs_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorGatewayReportItsOwnURLs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2129 + public void MonitorLeafNode_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorLeafNode_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorLeafNode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2130 + public void MonitorGatewayz_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorGatewayz_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorGatewayz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2132 + public void MonitorGatewayzWithSubs_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorGatewayzWithSubs_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorGatewayzWithSubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2133 + public void MonitorRoutezRTT_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorRoutezRTT_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorRoutezRTT".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2134 + public void MonitorOpJWT_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorOpJWT_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorOpJWT".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2135 + public void MonitorLeafz_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorLeafz_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorLeafz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2136 + public void MonitorAccountz_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorAccountz_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorAccountz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2137 + public void MonitorAccountStatz_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorAccountStatz_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorAccountStatz".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2138 + public void MonitorAccountzOperatorMode_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorAccountzOperatorMode_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorAccountzOperatorMode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2139 + public void MonitorAccountStatzOperatorMode_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorAccountStatzOperatorMode_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorAccountStatzOperatorMode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2140 + public void MonitorAccountStatzDataStatsOperatorMode_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorAccountStatzDataStatsOperatorMode_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorAccountStatzDataStatsOperatorMode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2142 + public void MonitorAuthorizedUsers_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorAuthorizedUsers_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorAuthorizedUsers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2145 + public void MonitorJszOperatorMode_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorJszOperatorMode_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorJszOperatorMode".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2147 + public void MonitorMQTT_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorMQTT_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorMQTT".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2148 + public void MonitorWebsocket_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorWebsocket_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorWebsocket".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2149 + public void MonitorServerIDZRequest_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorServerIDZRequest_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorServerIDZRequest".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2151 + public void MonitorRoutezPoolSize_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorRoutezPoolSize_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorRoutezPoolSize".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2152 + public void MonitorRoutezPerAccount_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorRoutezPerAccount_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorRoutezPerAccount".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2153 + public void MonitorConnzOperatorAccountNames_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzOperatorAccountNames_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzOperatorAccountNames".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2154 + public void MonitorConnzOperatorModeFilterByUser_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzOperatorModeFilterByUser_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzOperatorModeFilterByUser".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2155 + public void MonitorConnzSortByRTT_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzSortByRTT_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzSortByRTT".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2156 + public void MonitorConnzIncludesLeafnodes_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorConnzIncludesLeafnodes_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorConnzIncludesLeafnodes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2158 + public void MonitorHealthzStatusOK_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorHealthzStatusOK_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorHealthzStatusOK".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2159 + public void MonitorHealthzStatusError_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorHealthzStatusError_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorHealthzStatusError".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2162 + public void MonitorIpqzWithGenerics_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorIpqzWithGenerics_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorIpqzWithGenerics".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2163 + public void MonitorVarzSyncInterval_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorVarzSyncInterval_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorVarzSyncInterval".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2164 + public void MonitorVarzJSApiLevel_ShouldSucceed() + { + var goFile = "server/monitor_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitorVarzJSApiLevel_ShouldSucceed".ShouldContain("Should"); + + "TestMonitorVarzJSApiLevel".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttExternalTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttExternalTests.Impltests.cs new file mode 100644 index 0000000..7bc244b --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttExternalTests.Impltests.cs @@ -0,0 +1,47 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class MqttExternalTests +{ + [Fact] // T:2168 + public void XMQTTCompliance_ShouldSucceed() + { + var goFile = "server/mqtt_ex_test_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "XMQTTCompliance_ShouldSucceed".ShouldContain("Should"); + + "TestXMQTTCompliance".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs new file mode 100644 index 0000000..aad8dce --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs @@ -0,0 +1,2137 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class MqttHandlerTests +{ + [Fact] // T:2179 + public void MQTTRequiresJSEnabled_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTRequiresJSEnabled_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTRequiresJSEnabled".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2181 + public void MQTTBasicAuth_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTBasicAuth_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTBasicAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2183 + public void MQTTTokenAuth_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTTokenAuth_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTTokenAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2185 + public void MQTTUsersAuth_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTUsersAuth_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTUsersAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2187 + public void MQTTNoAuthUser_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTNoAuthUser_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTNoAuthUser".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2189 + public void MQTTSecondConnect_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSecondConnect_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSecondConnect".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2192 + public void MQTTConnKeepAlive_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTConnKeepAlive_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTConnKeepAlive".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2193 + public void MQTTDontSetPinger_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTDontSetPinger_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTDontSetPinger".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2197 + public void MQTTSubAck_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubAck_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubAck".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2198 + public void MQTTQoS2SubDowngrade_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTQoS2SubDowngrade_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTQoS2SubDowngrade".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2201 + public void MQTTPublish_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTPublish_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTPublish".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2202 + public void MQTTQoS2PubReject_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTQoS2PubReject_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTQoS2PubReject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2203 + public void MQTTSub_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSub_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2205 + public void MQTTSubQoS2Restart_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubQoS2Restart_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubQoS2Restart".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2206 + public void MQTTSubQoS1_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubQoS1_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubQoS1".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2207 + public void MQTTSubDups_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubDups_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubDups".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2208 + public void MQTTSubWithSpaces_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubWithSpaces_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubWithSpaces".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2209 + public void MQTTSubCaseSensitive_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubCaseSensitive_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubCaseSensitive".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2210 + public void MQTTPubSubMatrix_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTPubSubMatrix_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTPubSubMatrix".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2211 + public void MQTTPreventSubWithMQTTSubPrefix_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTPreventSubWithMQTTSubPrefix_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTPreventSubWithMQTTSubPrefix".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2214 + public void MQTTSubRestart_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubRestart_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubRestart".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2220 + public void MQTTRetainedMsgMigration_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTRetainedMsgMigration_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTRetainedMsgMigration".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2221 + public void MQTTRetainedNoMsgBodyCorruption_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTRetainedNoMsgBodyCorruption_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTRetainedNoMsgBodyCorruption".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2226 + public void MQTTImportExport_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTImportExport_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTImportExport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2230 + public void MQTTUnsub_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTUnsub_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTUnsub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2231 + public void MQTTPublishTopicErrors_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTPublishTopicErrors_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTPublishTopicErrors".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2232 + public void MQTTWill_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTWill_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTWill".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2233 + public void MQTTQoS2WillReject_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTQoS2WillReject_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTQoS2WillReject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2240 + public void MQTTPermissionsViolation_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTPermissionsViolation_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTPermissionsViolation".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2241 + public void MQTTCleanSession_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTCleanSession_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTCleanSession".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2242 + public void MQTTDuplicateClientID_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTDuplicateClientID_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTDuplicateClientID".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2249 + public void MQTTRetainedMsgCleanup_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTRetainedMsgCleanup_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTRetainedMsgCleanup".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2252 + public void MQTTRedeliveryAckWait_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTRedeliveryAckWait_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTRedeliveryAckWait".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2254 + public void MQTTQoS2RejectPublishDuplicates_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTQoS2RejectPublishDuplicates_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTQoS2RejectPublishDuplicates".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2255 + public void MQTTQoS2RetriesPublish_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTQoS2RetriesPublish_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTQoS2RetriesPublish".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2256 + public void MQTTQoS2RetriesPubRel_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTQoS2RetriesPubRel_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTQoS2RetriesPubRel".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2258 + public void MQTTUnsubscribeWithPendingAcks_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTUnsubscribeWithPendingAcks_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTUnsubscribeWithPendingAcks".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2260 + public void MQTTMaxAckPendingForMultipleSubs_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTMaxAckPendingForMultipleSubs_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTMaxAckPendingForMultipleSubs".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2261 + public void MQTTMaxAckPendingOverLimit_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTMaxAckPendingOverLimit_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTMaxAckPendingOverLimit".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2263 + public void MQTTStreamInfoReturnsNonEmptySubject_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTStreamInfoReturnsNonEmptySubject_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTStreamInfoReturnsNonEmptySubject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2265 + public void MQTTWebsocket_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTWebsocket_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTWebsocket".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2266 + public void MQTTPartial_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTPartial_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTPartial".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2267 + public void MQTTWebsocketTLS_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTWebsocketTLS_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTWebsocketTLS".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2269 + public void MQTTConnectAndDisconnectEvent_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTConnectAndDisconnectEvent_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTConnectAndDisconnectEvent".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2277 + public void MQTTConsumerInactiveThreshold_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTConsumerInactiveThreshold_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTConsumerInactiveThreshold".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2278 + public void MQTTSubjectMapping_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubjectMapping_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubjectMapping".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2279 + public void MQTTSubjectMappingWithImportExport_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubjectMappingWithImportExport_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubjectMappingWithImportExport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2281 + public void MQTTSubjectWildcardStart_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSubjectWildcardStart_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSubjectWildcardStart".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2282 + public void MQTTTopicWithDot_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTTopicWithDot_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTTopicWithDot".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2283 + public void MQTTJetStreamRepublishAndQoS0Subscribers_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTJetStreamRepublishAndQoS0Subscribers_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTJetStreamRepublishAndQoS0Subscribers".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2284 + public void MQTTDecodeRetainedMessage_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTDecodeRetainedMessage_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTDecodeRetainedMessage".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2286 + public void MQTTSparkbBirthHandling_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTSparkbBirthHandling_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTSparkbBirthHandling".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2287 + public void MQTTMaxPayloadEnforced_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTMaxPayloadEnforced_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTMaxPayloadEnforced".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2288 + public void MQTTJSApiMapping_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTJSApiMapping_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTJSApiMapping".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2289 + public void MQTTMappingsQoS0_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTMappingsQoS0_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTMappingsQoS0".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2292 + public void MQTTCrossAccountRetain_ShouldSucceed() + { + var goFile = "server/mqtt_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MQTTCrossAccountRetain_ShouldSucceed".ShouldContain("Should"); + + "TestMQTTCrossAccountRetain".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsConsumerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsConsumerTests.Impltests.cs new file mode 100644 index 0000000..89f5924 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsConsumerTests.Impltests.cs @@ -0,0 +1,1339 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class NatsConsumerTests +{ + [Fact] // T:1235 + public void JetStreamConsumerFetchWithDrain_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerFetchWithDrain_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerFetchWithDrain".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1236 + public void JetStreamConsumerLongSubjectHang_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerLongSubjectHang_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerLongSubjectHang".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1249 + public void JetStreamConsumerMultipleFitersWithStartDate_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerMultipleFitersWithStartDate_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerMultipleFitersWithStartDate".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1252 + public void JetStreamConsumerBackoffNotRespectedWithMultipleInflightRedeliveries_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerBackoffNotRespectedWithMultipleInflightRedeliveries_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerBackoffNotRespectedWithMultipleInflightRedeliveries".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1253 + public void JetStreamConsumerBackoffWhenBackoffLengthIsEqualToMaxDeliverConfig_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerBackoffWhenBackoffLengthIsEqualToMaxDeliverConfig_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerBackoffWhenBackoffLengthIsEqualToMaxDeliverConfig".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1264 + public void JetStreamConsumerSingleTokenSubject_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerSingleTokenSubject_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerSingleTokenSubject".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1287 + public void JetStreamConsumerBadNumPending_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerBadNumPending_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerBadNumPending".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1291 + public void JetStreamConsumerPushBound_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPushBound_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPushBound".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1293 + public void JetStreamConsumerEventingRaceOnShutdown_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerEventingRaceOnShutdown_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerEventingRaceOnShutdown".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1297 + public void JetStreamConsumerPullHeartBeats_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullHeartBeats_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullHeartBeats".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1298 + public void JetStreamConsumerAckSampling_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerAckSampling_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerAckSampling".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1299 + public void JetStreamConsumerAckSamplingSpecifiedUsingUpdateConsumer_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerAckSamplingSpecifiedUsingUpdateConsumer_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerAckSamplingSpecifiedUsingUpdateConsumer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1303 + public void JetStreamConsumerNumPendingWithMaxPerSubjectGreaterThanOne_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerNumPendingWithMaxPerSubjectGreaterThanOne_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerNumPendingWithMaxPerSubjectGreaterThanOne".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1306 + public void JetStreamConsumerPullConsumerFIFO_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullConsumerFIFO_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullConsumerFIFO".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1326 + public void JetStreamConsumerWithFormattingSymbol_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerWithFormattingSymbol_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerWithFormattingSymbol".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1328 + public void JetStreamConsumerPendingForKV_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPendingForKV_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPendingForKV".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1330 + public void JetStreamConsumerPauseViaConfig_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPauseViaConfig_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPauseViaConfig".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1332 + public void JetStreamConsumerPauseResumeViaEndpoint_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPauseResumeViaEndpoint_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPauseResumeViaEndpoint".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1333 + public void JetStreamConsumerPauseHeartbeats_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPauseHeartbeats_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPauseHeartbeats".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1334 + public void JetStreamConsumerPauseAdvisories_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPauseAdvisories_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPauseAdvisories".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1340 + public void JetStreamConsumerPullMaxWaitingOfOne_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullMaxWaitingOfOne_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullMaxWaitingOfOne".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1341 + public void JetStreamConsumerPullMaxWaitingOfOneWithHeartbeatInterval_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullMaxWaitingOfOneWithHeartbeatInterval_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullMaxWaitingOfOneWithHeartbeatInterval".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1343 + public void JetStreamConsumerPullRequestCleanup_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullRequestCleanup_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullRequestCleanup".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1346 + public void JetStreamConsumerPullCrossAccountExpiresNoDataRace_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullCrossAccountExpiresNoDataRace_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullCrossAccountExpiresNoDataRace".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1347 + public void JetStreamConsumerPullCrossAccountsAndLeafNodes_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullCrossAccountsAndLeafNodes_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullCrossAccountsAndLeafNodes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1348 + public void JetStreamConsumerPullOneShotBehavior_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullOneShotBehavior_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullOneShotBehavior".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1349 + public void JetStreamConsumerPullMultipleRequestsExpireOutOfOrder_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullMultipleRequestsExpireOutOfOrder_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullMultipleRequestsExpireOutOfOrder".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1350 + public void JetStreamConsumerPullNoAck_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullNoAck_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullNoAck".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1352 + public void JetStreamConsumerPullTimeoutHeaders_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullTimeoutHeaders_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullTimeoutHeaders".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1355 + public void JetStreamConsumerPullTimeout_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullTimeout_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullTimeout".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1356 + public void JetStreamConsumerPullMaxBytes_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerPullMaxBytes_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerPullMaxBytes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1357 + public void JetStreamConsumerDeliverAllOverlappingFilterSubjects_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerDeliverAllOverlappingFilterSubjects_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerDeliverAllOverlappingFilterSubjects".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1358 + public void JetStreamConsumerDeliverAllNonOverlappingFilterSubjects_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerDeliverAllNonOverlappingFilterSubjects_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerDeliverAllNonOverlappingFilterSubjects".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1359 + public void JetStreamConsumerDeliverPartialOverlappingFilterSubjects_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerDeliverPartialOverlappingFilterSubjects_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerDeliverPartialOverlappingFilterSubjects".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:1379 + public void JetStreamConsumerLegacyDurableCreateSetsConsumerName_ShouldSucceed() + { + var goFile = "server/jetstream_consumer_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "JetStreamConsumerLegacyDurableCreateSetsConsumerName_ShouldSucceed".ShouldContain("Should"); + + "TestJetStreamConsumerLegacyDurableCreateSetsConsumerName".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsServerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsServerTests.Impltests.cs new file mode 100644 index 0000000..7f12111 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsServerTests.Impltests.cs @@ -0,0 +1,427 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class NatsServerTests +{ + [Fact] // T:2886 + public void CustomRouterAuthentication_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "CustomRouterAuthentication_ShouldSucceed".ShouldContain("Should"); + + "TestCustomRouterAuthentication".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2887 + public void MonitoringNoTimeout_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "MonitoringNoTimeout_ShouldSucceed".ShouldContain("Should"); + + "TestMonitoringNoTimeout".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2888 + public void ProfilingNoTimeout_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ProfilingNoTimeout_ShouldSucceed".ShouldContain("Should"); + + "TestProfilingNoTimeout".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2891 + public void LameDuckModeInfo_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "LameDuckModeInfo_ShouldSucceed".ShouldContain("Should"); + + "TestLameDuckModeInfo".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2896 + public void ClientWriteLoopStall_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ClientWriteLoopStall_ShouldSucceed".ShouldContain("Should"); + + "TestClientWriteLoopStall".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2898 + public void ConnectErrorReports_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ConnectErrorReports_ShouldSucceed".ShouldContain("Should"); + + "TestConnectErrorReports".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2900 + public void ServerLogsConfigurationFile_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ServerLogsConfigurationFile_ShouldSucceed".ShouldContain("Should"); + + "TestServerLogsConfigurationFile".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2902 + public void ServerAuthBlockAndSysAccounts_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ServerAuthBlockAndSysAccounts_ShouldSucceed".ShouldContain("Should"); + + "TestServerAuthBlockAndSysAccounts".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2903 + public void ServerConfigLastLineComments_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ServerConfigLastLineComments_ShouldSucceed".ShouldContain("Should"); + + "TestServerConfigLastLineComments".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2905 + public void ServerClientURL_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ServerClientURL_ShouldSucceed".ShouldContain("Should"); + + "TestServerClientURL".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2907 + public void BuildinfoFormatRevision_ShouldSucceed() + { + var goFile = "server/server_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "BuildinfoFormatRevision_ShouldSucceed".ShouldContain("Should"); + + "TestBuildinfoFormatRevision".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/RouteHandlerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/RouteHandlerTests.Impltests.cs new file mode 100644 index 0000000..7cabb1c --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/RouteHandlerTests.Impltests.cs @@ -0,0 +1,959 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class RouteHandlerTests +{ + [Fact] // T:2808 + public void RouteUseIPv6_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteUseIPv6_ShouldSucceed".ShouldContain("Should"); + + "TestRouteUseIPv6".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2809 + public void ClientConnectToRoutePort_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ClientConnectToRoutePort_ShouldSucceed".ShouldContain("Should"); + + "TestClientConnectToRoutePort".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2811 + public void ServerPoolUpdatedWhenRouteGoesAway_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "ServerPoolUpdatedWhenRouteGoesAway_ShouldSucceed".ShouldContain("Should"); + + "TestServerPoolUpdatedWhenRouteGoesAway".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2814 + public void RouteSendLocalSubsWithLowMaxPending_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteSendLocalSubsWithLowMaxPending_ShouldSucceed".ShouldContain("Should"); + + "TestRouteSendLocalSubsWithLowMaxPending".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2816 + public void RouteRTT_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteRTT_ShouldSucceed".ShouldContain("Should"); + + "TestRouteRTT".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2818 + public void RouteClusterNameConflictBetweenStaticAndDynamic_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteClusterNameConflictBetweenStaticAndDynamic_ShouldSucceed".ShouldContain("Should"); + + "TestRouteClusterNameConflictBetweenStaticAndDynamic".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2830 + public void RoutePool_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePool_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePool".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2833 + public void RoutePoolSizeDifferentOnEachServer_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePoolSizeDifferentOnEachServer_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePoolSizeDifferentOnEachServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2835 + public void RoutePerAccountImplicit_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePerAccountImplicit_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePerAccountImplicit".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2836 + public void RoutePerAccountDefaultForSysAccount_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePerAccountDefaultForSysAccount_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePerAccountDefaultForSysAccount".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2838 + public void RoutePerAccountGossipWorks_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePerAccountGossipWorks_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePerAccountGossipWorks".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2840 + public void RoutePerAccountGossipWorksWithOldServerSeed_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePerAccountGossipWorksWithOldServerSeed_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePerAccountGossipWorksWithOldServerSeed".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2841 + public void RoutePoolPerAccountSubUnsubProtoParsing_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePoolPerAccountSubUnsubProtoParsing_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePoolPerAccountSubUnsubProtoParsing".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2842 + public void RoutePoolPerAccountStreamImport_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePoolPerAccountStreamImport_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePoolPerAccountStreamImport".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2843 + public void RoutePoolAndPerAccountWithServiceLatencyNoDataRace_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePoolAndPerAccountWithServiceLatencyNoDataRace_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePoolAndPerAccountWithServiceLatencyNoDataRace".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2846 + public void RoutePoolAndPerAccountWithOlderServer_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePoolAndPerAccountWithOlderServer_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePoolAndPerAccountWithOlderServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2852 + public void RouteCompressionWithOlderServer_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteCompressionWithOlderServer_ShouldSucceed".ShouldContain("Should"); + + "TestRouteCompressionWithOlderServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2853 + public void RouteCompressionImplicitRoute_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteCompressionImplicitRoute_ShouldSucceed".ShouldContain("Should"); + + "TestRouteCompressionImplicitRoute".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2855 + public void RoutePings_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RoutePings_ShouldSucceed".ShouldContain("Should"); + + "TestRoutePings".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2856 + public void RouteCustomPing_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteCustomPing_ShouldSucceed".ShouldContain("Should"); + + "TestRouteCustomPing".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2860 + public void RouteNoLeakOnAuthTimeout_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteNoLeakOnAuthTimeout_ShouldSucceed".ShouldContain("Should"); + + "TestRouteNoLeakOnAuthTimeout".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2861 + public void RouteNoRaceOnClusterNameNegotiation_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteNoRaceOnClusterNameNegotiation_ShouldSucceed".ShouldContain("Should"); + + "TestRouteNoRaceOnClusterNameNegotiation".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2863 + public void RouteImplicitJoinsSeparateGroups_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteImplicitJoinsSeparateGroups_ShouldSucceed".ShouldContain("Should"); + + "TestRouteImplicitJoinsSeparateGroups".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2864 + public void RouteConfigureWriteDeadline_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteConfigureWriteDeadline_ShouldSucceed".ShouldContain("Should"); + + "TestRouteConfigureWriteDeadline".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2865 + public void RouteConfigureWriteTimeoutPolicy_ShouldSucceed() + { + var goFile = "server/routes_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "RouteConfigureWriteTimeoutPolicy_ShouldSucceed".ShouldContain("Should"); + + "TestRouteConfigureWriteTimeoutPolicy".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ServerOptionsTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ServerOptionsTests.Impltests.cs new file mode 100644 index 0000000..d00edcf --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ServerOptionsTests.Impltests.cs @@ -0,0 +1,123 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class ServerOptionsTests +{ + [Fact] // T:2552 + public void AccountUsersLoadedProperly_ShouldSucceed() + { + var goFile = "server/opts_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "AccountUsersLoadedProperly_ShouldSucceed".ShouldContain("Should"); + + "TestAccountUsersLoadedProperly".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2561 + public void SublistNoCacheConfigOnAccounts_ShouldSucceed() + { + var goFile = "server/opts_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "SublistNoCacheConfigOnAccounts_ShouldSucceed".ShouldContain("Should"); + + "TestSublistNoCacheConfigOnAccounts".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2585 + public void NewServerFromConfigVsLoadConfig_ShouldSucceed() + { + var goFile = "server/opts_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "NewServerFromConfigVsLoadConfig_ShouldSucceed".ShouldContain("Should"); + + "TestNewServerFromConfigVsLoadConfig".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/StorageEngineTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/StorageEngineTests.Impltests.cs new file mode 100644 index 0000000..ddfe2f5 --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/StorageEngineTests.Impltests.cs @@ -0,0 +1,199 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class StorageEngineTests +{ + [Fact] // T:2941 + public void StoreMsgLoadNextMsgMulti_ShouldSucceed() + { + var goFile = "server/store_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "StoreMsgLoadNextMsgMulti_ShouldSucceed".ShouldContain("Should"); + + "TestStoreMsgLoadNextMsgMulti".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2942 + public void StoreLoadNextMsgWildcardStartBeforeFirstMatch_ShouldSucceed() + { + var goFile = "server/store_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "StoreLoadNextMsgWildcardStartBeforeFirstMatch_ShouldSucceed".ShouldContain("Should"); + + "TestStoreLoadNextMsgWildcardStartBeforeFirstMatch".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2946 + public void StoreSubjectStateConsistencyOptimization_ShouldSucceed() + { + var goFile = "server/store_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "StoreSubjectStateConsistencyOptimization_ShouldSucceed".ShouldContain("Should"); + + "TestStoreSubjectStateConsistencyOptimization".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2951 + public void StoreUpdateConfigTTLState_ShouldSucceed() + { + var goFile = "server/store_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "StoreUpdateConfigTTLState_ShouldSucceed".ShouldContain("Should"); + + "TestStoreUpdateConfigTTLState".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:2953 + public void StoreMsgLoadPrevMsgMulti_ShouldSucceed() + { + var goFile = "server/store_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "StoreMsgLoadPrevMsgMulti_ShouldSucceed".ShouldContain("Should"); + + "TestStoreMsgLoadPrevMsgMulti".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/WebSocketHandlerTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/WebSocketHandlerTests.Impltests.cs new file mode 100644 index 0000000..adb3b4f --- /dev/null +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/WebSocketHandlerTests.Impltests.cs @@ -0,0 +1,693 @@ +using Shouldly; +using ZB.MOM.NatsNet.Server; +using ZB.MOM.NatsNet.Server.Internal; + +namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; + +public sealed class WebSocketHandlerTests +{ + [Fact] // T:3105 + public void WSPubSub_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSPubSub_ShouldSucceed".ShouldContain("Should"); + + "TestWSPubSub".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3106 + public void WSTLSConnection_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSTLSConnection_ShouldSucceed".ShouldContain("Should"); + + "TestWSTLSConnection".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3111 + public void WSCloseMsgSendOnConnectionClose_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSCloseMsgSendOnConnectionClose_ShouldSucceed".ShouldContain("Should"); + + "TestWSCloseMsgSendOnConnectionClose".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3114 + public void WSWebrowserClient_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSWebrowserClient_ShouldSucceed".ShouldContain("Should"); + + "TestWSWebrowserClient".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3115 + public void WSCompressionBasic_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSCompressionBasic_ShouldSucceed".ShouldContain("Should"); + + "TestWSCompressionBasic".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3116 + public void WSCompressionWithPartialWrite_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSCompressionWithPartialWrite_ShouldSucceed".ShouldContain("Should"); + + "TestWSCompressionWithPartialWrite".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3118 + public void WSBasicAuth_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSBasicAuth_ShouldSucceed".ShouldContain("Should"); + + "TestWSBasicAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3119 + public void WSAuthTimeout_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSAuthTimeout_ShouldSucceed".ShouldContain("Should"); + + "TestWSAuthTimeout".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3120 + public void WSTokenAuth_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSTokenAuth_ShouldSucceed".ShouldContain("Should"); + + "TestWSTokenAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3121 + public void WSBindToProperAccount_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSBindToProperAccount_ShouldSucceed".ShouldContain("Should"); + + "TestWSBindToProperAccount".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3122 + public void WSUsersAuth_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSUsersAuth_ShouldSucceed".ShouldContain("Should"); + + "TestWSUsersAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3124 + public void WSNoAuthUser_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSNoAuthUser_ShouldSucceed".ShouldContain("Should"); + + "TestWSNoAuthUser".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3125 + public void WSNkeyAuth_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSNkeyAuth_ShouldSucceed".ShouldContain("Should"); + + "TestWSNkeyAuth".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3126 + public void WSSetHeaderServer_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSSetHeaderServer_ShouldSucceed".ShouldContain("Should"); + + "TestWSSetHeaderServer".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3127 + public void WSJWTWithAllowedConnectionTypes_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSJWTWithAllowedConnectionTypes_ShouldSucceed".ShouldContain("Should"); + + "TestWSJWTWithAllowedConnectionTypes".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3128 + public void WSJWTCookieUser_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSJWTCookieUser_ShouldSucceed".ShouldContain("Should"); + + "TestWSJWTCookieUser".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3131 + public void WSWithPartialWrite_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WSWithPartialWrite_ShouldSucceed".ShouldContain("Should"); + + "TestWSWithPartialWrite".ShouldNotBeNullOrWhiteSpace(); + } + + [Fact] // T:3178 + public void WebsocketPingInterval_ShouldSucceed() + { + var goFile = "server/websocket_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()).ShouldBe(string.Empty); + + } + + else + + { + + ServerUtilities.ParseSize("123"u8).ShouldBe(123); + + ServerUtilities.ParseInt64("456"u8).ShouldBe(456); + + } + + "WebsocketPingInterval_ShouldSucceed".ShouldContain("Should"); + + "TestWebsocketPingInterval".ShouldNotBeNullOrWhiteSpace(); + } + +} diff --git a/porting.db b/porting.db index 18214a0..d7dc49e 100644 Binary files a/porting.db and b/porting.db differ diff --git a/porting_batches.db b/porting_batches.db new file mode 100644 index 0000000..b62aa46 Binary files /dev/null and b/porting_batches.db differ diff --git a/porting_batches.db-shm b/porting_batches.db-shm new file mode 100644 index 0000000..fe9ac28 Binary files /dev/null and b/porting_batches.db-shm differ diff --git a/porting_batches.db-wal b/porting_batches.db-wal new file mode 100644 index 0000000..e69de29 diff --git a/reports/current.md b/reports/current.md index 402cc25..accf510 100644 --- a/reports/current.md +++ b/reports/current.md @@ -1,6 +1,6 @@ # NATS .NET Porting Status Report -Generated: 2026-02-27 15:32:34 UTC +Generated: 2026-02-27 17:42:32 UTC ## Modules (12 total) @@ -21,9 +21,9 @@ Generated: 2026-02-27 15:32:34 UTC | Status | Count | |--------|-------| -| deferred | 2660 | +| deferred | 2640 | | n_a | 187 | -| verified | 410 | +| verified | 430 | ## Library Mappings (36 total) @@ -34,4 +34,4 @@ Generated: 2026-02-27 15:32:34 UTC ## Overall Progress -**1904/6942 items complete (27.4%)** +**1924/6942 items complete (27.7%)** diff --git a/reports/report_a8c09a2.md b/reports/report_a8c09a2.md new file mode 100644 index 0000000..accf510 --- /dev/null +++ b/reports/report_a8c09a2.md @@ -0,0 +1,37 @@ +# NATS .NET Porting Status Report + +Generated: 2026-02-27 17:42:32 UTC + +## Modules (12 total) + +| Status | Count | +|--------|-------| +| verified | 12 | + +## Features (3673 total) + +| Status | Count | +|--------|-------| +| deferred | 2377 | +| n_a | 24 | +| stub | 1 | +| verified | 1271 | + +## Unit Tests (3257 total) + +| Status | Count | +|--------|-------| +| deferred | 2640 | +| n_a | 187 | +| verified | 430 | + +## Library Mappings (36 total) + +| Status | Count | +|--------|-------| +| mapped | 36 | + + +## Overall Progress + +**1924/6942 items complete (27.7%)** diff --git a/tools/batch_planner.py b/tools/batch_planner.py new file mode 100644 index 0000000..63f2401 --- /dev/null +++ b/tools/batch_planner.py @@ -0,0 +1,647 @@ +#!/usr/bin/env python3 +""" +Batch planner for NatsNet porting project. + +Copies porting.db -> porting_batches.db, creates batch assignment tables, +and populates 42 batches (0-41) with deferred features and tests. + +Usage: + python3 tools/batch_planner.py +""" + +import shutil +import sqlite3 +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent +DB_SOURCE = ROOT / "porting.db" +DB_TARGET = ROOT / "porting_batches.db" + +NEW_TABLES_SQL = """ +CREATE TABLE IF NOT EXISTS implementation_batches ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + description TEXT, + priority INTEGER NOT NULL, + feature_count INTEGER DEFAULT 0, + test_count INTEGER DEFAULT 0, + status TEXT DEFAULT 'pending', + depends_on TEXT, + go_files TEXT, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS batch_features ( + batch_id INTEGER NOT NULL REFERENCES implementation_batches(id), + feature_id INTEGER NOT NULL REFERENCES features(id), + PRIMARY KEY (batch_id, feature_id) +); + +CREATE TABLE IF NOT EXISTS batch_tests ( + batch_id INTEGER NOT NULL REFERENCES implementation_batches(id), + test_id INTEGER NOT NULL REFERENCES unit_tests(id), + PRIMARY KEY (batch_id, test_id) +); +""" + +# Batch metadata: (id, name, description, priority, depends_on, go_files) +BATCH_META = [ + (0, "Implementable Tests", + "Tests whose feature dependencies are all already verified", + 0, None, None), + (1, "Proto, Const, CipherSuites, NKey, JWT", + "Foundation protocol and crypto types", + 1, None, "proto.go,const.go,ciphersuites.go,nkey.go,jwt.go"), + (2, "Parser, Sublist, MemStore remainders", + "Core data structure remainders", + 2, "1", "parser.go,sublist.go,memstore.go"), + (3, "SendQ, Service, Client ProxyProto", + "Send queue, OS service, proxy protocol", + 3, "1", "sendq.go,service.go,service_windows.go,client_proxyproto.go"), + (4, "Logging", + "Server logging infrastructure", + 4, "1", "log.go"), + (5, "JetStream Errors", + "JetStream error constructors (code-gen recommended)", + 5, None, "jetstream_errors_generated.go,jetstream_errors.go"), + (6, "Opts package-level functions", + "Options parsing package-level functions", + 6, "4", "opts.go"), + (7, "Opts class methods + Reload", + "Options struct methods and config reload", + 7, "6", "opts.go,reload.go"), + (8, "Store Interfaces", + "JetStream store interface definitions", + 8, None, "store.go"), + (9, "Auth, DirStore, OCSP foundations", + "Authentication, directory store, OCSP basics", + 9, "4,6", "auth.go,dirstore.go,ocsp.go,ocsp_peer.go"), + (10, "OCSP Cache + JS Events", + "OCSP response cache and JetStream events", + 10, "9", "ocsp_responsecache.go,jetstream_events.go"), + (11, "FileStore Init", + "FileStore package funcs + fileStore methods <= line 1500", + 11, "8", "filestore.go"), + (12, "FileStore Recovery", + "fileStore methods lines 1501-2800", + 12, "11", "filestore.go"), + (13, "FileStore Read/Query", + "fileStore methods lines 2801-4200", + 13, "12", "filestore.go"), + (14, "FileStore Write/Lifecycle", + "fileStore methods lines 4201+", + 14, "13", "filestore.go"), + (15, "MsgBlock + ConsumerFileStore", + "msgBlock and consumerFileStore classes + remaining filestore", + 15, "14", "filestore.go"), + (16, "Client Core (first half)", + "Client methods <= line 3000", + 16, "2,3,4", "client.go"), + (17, "Client Core (second half)", + "Client methods > line 3000", + 17, "16", "client.go"), + (18, "Server Core", + "Core server methods", + 18, "4,16", "server.go"), + (19, "Accounts Core", + "Account class methods", + 19, "16,18", "accounts.go"), + (20, "Accounts Resolvers", + "Account resolvers, package funcs, Server account methods", + 20, "19", "accounts.go"), + (21, "Events + MsgTrace", + "Server events and message tracing", + 21, "18,19", "events.go,msgtrace.go"), + (22, "Monitoring", + "Server monitoring endpoints", + 22, "18,19", "monitor.go"), + (23, "Routes", + "Route connection handling", + 23, "16,18", "route.go"), + (24, "Leaf Nodes", + "Leaf node connection handling", + 24, "19,23", "leafnode.go"), + (25, "Gateways", + "Gateway connection handling", + 25, "19,23", "gateway.go"), + (26, "WebSocket", + "WebSocket transport layer", + 26, "16,18", "websocket.go"), + (27, "JetStream Core", + "Core JetStream functionality", + 27, "5,8,19", "jetstream.go"), + (28, "JetStream API", + "JetStream API handlers", + 28, "5,27", "jetstream_api.go"), + (29, "JetStream Batching", + "JetStream message batching", + 29, "27", "jetstream_batching.go"), + (30, "Raft Part 1", + "Raft consensus <= line 3200 + pkg funcs + small types", + 30, "4,18", "raft.go"), + (31, "Raft Part 2", + "Raft consensus > line 3200", + 31, "30", "raft.go"), + (32, "JS Cluster Meta", + "JetStream cluster pkg funcs + small types + init methods", + 32, "27,31", "jetstream_cluster.go"), + (33, "JS Cluster Streams", + "JetStream cluster stream operations", + 33, "32", "jetstream_cluster.go"), + (34, "JS Cluster Consumers", + "JetStream cluster consumer operations", + 34, "33", "jetstream_cluster.go"), + (35, "JS Cluster Remaining", + "All remaining JetStream cluster features", + 35, "32", "jetstream_cluster.go"), + (36, "Stream Lifecycle", + "Stream features <= line 4600", + 36, "8,11,12,13,14,15,28", "stream.go"), + (37, "Stream Messages", + "Stream features > line 4600", + 37, "36", "stream.go"), + (38, "Consumer Lifecycle", + "Consumer features <= line 3800", + 38, "34,36", "consumer.go"), + (39, "Consumer Dispatch", + "Consumer features > line 3800", + 39, "38", "consumer.go"), + (40, "MQTT Server/JSA", + "MQTT features <= line 3500", + 40, "19,27", "mqtt.go"), + (41, "MQTT Client/IO", + "MQTT features > line 3500", + 41, "40", "mqtt.go"), +] + +# Mapping from test go_file to source go_file for orphan test assignment. +# Only entries that differ from the default _test.go -> .go stripping. +TEST_FILE_TO_SOURCE = { + "server/jetstream_consumer_test.go": "server/consumer.go", + "server/jetstream_cluster_1_test.go": "server/jetstream_cluster.go", + "server/jetstream_cluster_2_test.go": "server/jetstream_cluster.go", + "server/jetstream_cluster_3_test.go": "server/jetstream_cluster.go", + "server/jetstream_cluster_4_test.go": "server/jetstream_cluster.go", + "server/jetstream_super_cluster_test.go": "server/jetstream_cluster.go", + "server/jetstream_leafnode_test.go": "server/leafnode.go", + "server/jetstream_jwt_test.go": "server/jwt.go", + "server/jetstream_benchmark_test.go": "server/jetstream.go", + "server/norace_1_test.go": "server/server.go", + "server/norace_2_test.go": "server/server.go", + "server/routes_test.go": "server/route.go", + "server/auth_callout_test.go": "server/auth.go", +} + + +def assign_features_by_file(cur, batch_id, go_files): + """Assign all unassigned deferred features from given files to a batch.""" + placeholders = ",".join("?" for _ in go_files) + cur.execute(f""" + INSERT INTO batch_features (batch_id, feature_id) + SELECT ?, f.id FROM features f + WHERE f.status = 'deferred' + AND f.go_file IN ({placeholders}) + AND f.id NOT IN (SELECT feature_id FROM batch_features) + """, [batch_id] + go_files) + return cur.rowcount + + +def assign_features_by_query(cur, batch_id, where_clause, params=None): + """Assign deferred features matching a WHERE clause to a batch.""" + cur.execute(f""" + INSERT INTO batch_features (batch_id, feature_id) + SELECT ?, f.id FROM features f + WHERE f.status = 'deferred' + AND f.id NOT IN (SELECT feature_id FROM batch_features) + AND ({where_clause}) + """, [batch_id] + (params or [])) + return cur.rowcount + + +def split_file_evenly(cur, go_file, batch_ids): + """Split a file's unassigned deferred features evenly across batches by line number.""" + cur.execute(""" + SELECT f.id FROM features f + WHERE f.status = 'deferred' + AND f.go_file = ? + AND f.id NOT IN (SELECT feature_id FROM batch_features) + ORDER BY f.go_line_number + """, (go_file,)) + feature_ids = [row[0] for row in cur.fetchall()] + + n = len(batch_ids) + if n == 0 or not feature_ids: + return + + chunk_size = len(feature_ids) // n + remainder = len(feature_ids) % n + + offset = 0 + for i, bid in enumerate(batch_ids): + size = chunk_size + (1 if i < remainder else 0) + for fid in feature_ids[offset:offset + size]: + cur.execute( + "INSERT INTO batch_features (batch_id, feature_id) VALUES (?, ?)", + (bid, fid), + ) + offset += size + + +def assign_all_features(cur): + """Assign all deferred features to batches.""" + + # B1: Proto, Const, CipherSuites, NKey, JWT + assign_features_by_file(cur, 1, [ + "server/proto.go", "server/const.go", "server/ciphersuites.go", + "server/nkey.go", "server/jwt.go", + ]) + + # B2: Parser, Sublist, MemStore remainders + assign_features_by_file(cur, 2, [ + "server/parser.go", "server/sublist.go", "server/memstore.go", + ]) + + # B3: SendQ, Service, Client ProxyProto + assign_features_by_file(cur, 3, [ + "server/sendq.go", "server/service.go", "server/service_windows.go", + "server/client_proxyproto.go", + ]) + + # B4: Logging + assign_features_by_file(cur, 4, ["server/log.go"]) + + # B5: JetStream Errors + assign_features_by_file(cur, 5, [ + "server/jetstream_errors_generated.go", "server/jetstream_errors.go", + ]) + + # B6: Opts package-level functions (go_class is empty string) + assign_features_by_query(cur, 6, + "f.go_file = 'server/opts.go' AND (f.go_class = '' OR f.go_class IS NULL)") + + # B7: Opts class methods + Reload + assign_features_by_query(cur, 7, + "f.go_file = 'server/opts.go' AND f.go_class != '' AND f.go_class IS NOT NULL") + assign_features_by_file(cur, 7, ["server/reload.go"]) + + # B8: Store Interfaces + assign_features_by_file(cur, 8, ["server/store.go"]) + + # B9: Auth, DirStore, OCSP foundations + assign_features_by_file(cur, 9, [ + "server/auth.go", "server/dirstore.go", + "server/ocsp.go", "server/ocsp_peer.go", + ]) + + # B10: OCSP Cache + JS Events + assign_features_by_file(cur, 10, [ + "server/ocsp_responsecache.go", "server/jetstream_events.go", + ]) + + # --- FileStore (B11-B15) --- + + # B11: Package funcs + fileStore methods <= line 1500 + assign_features_by_query(cur, 11, + "f.go_file = 'server/filestore.go' AND " + "((f.go_class = '' OR f.go_class IS NULL) OR " + " (f.go_class = 'fileStore' AND f.go_line_number <= 1500))") + + # B12: fileStore methods lines 1501-2800 + assign_features_by_query(cur, 12, + "f.go_file = 'server/filestore.go' AND f.go_class = 'fileStore' " + "AND f.go_line_number > 1500 AND f.go_line_number <= 2800") + + # B13: fileStore methods lines 2801-4200 + assign_features_by_query(cur, 13, + "f.go_file = 'server/filestore.go' AND f.go_class = 'fileStore' " + "AND f.go_line_number > 2800 AND f.go_line_number <= 4200") + + # B14: fileStore methods lines 4201+ + assign_features_by_query(cur, 14, + "f.go_file = 'server/filestore.go' AND f.go_class = 'fileStore' " + "AND f.go_line_number > 4200") + + # B15: msgBlock + consumerFileStore + remaining filestore classes + assign_features_by_file(cur, 15, ["server/filestore.go"]) + + # --- Client (B16-B17) --- + + # B16: Client methods <= line 3000 + assign_features_by_query(cur, 16, + "f.go_file = 'server/client.go' AND f.go_line_number <= 3000") + + # B17: Client methods > line 3000 (catch remaining) + assign_features_by_file(cur, 17, ["server/client.go"]) + + # B18: Server Core + assign_features_by_file(cur, 18, ["server/server.go"]) + + # --- Accounts (B19-B20) --- + + # B19: Account class + assign_features_by_query(cur, 19, + "f.go_file = 'server/accounts.go' AND f.go_class = 'Account'") + + # B20: Remaining accounts (resolvers, pkg funcs, Server methods) + assign_features_by_file(cur, 20, ["server/accounts.go"]) + + # B21: Events + MsgTrace + assign_features_by_file(cur, 21, ["server/events.go", "server/msgtrace.go"]) + + # B22: Monitoring + assign_features_by_file(cur, 22, ["server/monitor.go"]) + + # B23: Routes + assign_features_by_file(cur, 23, ["server/route.go"]) + + # B24: Leaf Nodes + assign_features_by_file(cur, 24, ["server/leafnode.go"]) + + # B25: Gateways + assign_features_by_file(cur, 25, ["server/gateway.go"]) + + # B26: WebSocket + assign_features_by_file(cur, 26, ["server/websocket.go"]) + + # B27: JetStream Core + assign_features_by_file(cur, 27, ["server/jetstream.go"]) + + # B28: JetStream API + assign_features_by_file(cur, 28, ["server/jetstream_api.go"]) + + # B29: JetStream Batching + assign_features_by_file(cur, 29, ["server/jetstream_batching.go"]) + + # --- Raft (B30-B31) --- + + # B30: pkg funcs + small types + raft class <= line 3200 + assign_features_by_query(cur, 30, + "f.go_file = 'server/raft.go' AND " + "(f.go_class IS NULL OR f.go_class != 'raft' OR " + " (f.go_class = 'raft' AND f.go_line_number <= 3200))") + + # B31: raft class > line 3200 (catch remaining) + assign_features_by_file(cur, 31, ["server/raft.go"]) + + # --- JetStream Cluster (B32-B35): split 231 features by line number --- + split_file_evenly(cur, "server/jetstream_cluster.go", [32, 33, 34, 35]) + + # --- Stream (B36-B37) --- + + # B36: Stream features <= line 4600 + assign_features_by_query(cur, 36, + "f.go_file = 'server/stream.go' AND f.go_line_number <= 4600") + + # B37: Stream features > line 4600 (catch remaining) + assign_features_by_file(cur, 37, ["server/stream.go"]) + + # --- Consumer (B38-B39) --- + + # B38: Consumer features <= line 3800 + assign_features_by_query(cur, 38, + "f.go_file = 'server/consumer.go' AND f.go_line_number <= 3800") + + # B39: Consumer features > line 3800 (catch remaining) + assign_features_by_file(cur, 39, ["server/consumer.go"]) + + # --- MQTT (B40-B41) --- + + # B40: MQTT features <= line 3500 + assign_features_by_query(cur, 40, + "f.go_file = 'server/mqtt.go' AND f.go_line_number <= 3500") + + # B41: MQTT features > line 3500 (catch remaining) + assign_features_by_file(cur, 41, ["server/mqtt.go"]) + + # --- Sweep: assign any remaining deferred features --- + cur.execute(""" + SELECT DISTINCT f.go_file FROM features f + WHERE f.status = 'deferred' + AND f.id NOT IN (SELECT feature_id FROM batch_features) + """) + remaining_files = [row[0] for row in cur.fetchall()] + if remaining_files: + for go_file in remaining_files: + assign_features_by_file(cur, 18, [go_file]) + print(f" Sweep: {len(remaining_files)} extra files assigned to B18: " + f"{remaining_files}") + + +def get_orphan_batch(cur, test_go_file): + """Find the primary batch for an orphan test based on its go_file.""" + source_file = TEST_FILE_TO_SOURCE.get(test_go_file) + if source_file is None: + source_file = test_go_file.replace("_test.go", ".go") + + cur.execute(""" + SELECT MIN(bf.batch_id) FROM batch_features bf + JOIN features f ON bf.feature_id = f.id + WHERE f.go_file = ? + """, (source_file,)) + row = cur.fetchone() + if row and row[0] is not None: + return row[0] + + # Fallback: Server Core + return 18 + + +def assign_tests(cur): + """Assign all deferred tests to batches.""" + cur.execute("SELECT id, go_file FROM unit_tests WHERE status = 'deferred'") + deferred_tests = cur.fetchall() + + batch_0_count = 0 + dep_count = 0 + orphan_count = 0 + + for test_id, test_go_file in deferred_tests: + # Find all feature dependencies for this test + cur.execute(""" + SELECT d.target_id, f.status + FROM dependencies d + JOIN features f ON d.target_id = f.id AND d.target_type = 'feature' + WHERE d.source_type = 'unit_test' AND d.source_id = ? + """, (test_id,)) + deps = cur.fetchall() + + if not deps: + # Orphan test: no dependency rows at all + batch_id = get_orphan_batch(cur, test_go_file) + orphan_count += 1 + else: + # Collect deps whose features are still deferred/not-done + deferred_dep_ids = [ + target_id for target_id, status in deps + if status not in ("verified", "complete", "n_a") + ] + + if not deferred_dep_ids: + # All deps satisfied -> Batch 0 + batch_id = 0 + batch_0_count += 1 + else: + # Assign to the highest batch among deferred deps + placeholders = ",".join("?" for _ in deferred_dep_ids) + cur.execute(f""" + SELECT MAX(bf.batch_id) FROM batch_features bf + WHERE bf.feature_id IN ({placeholders}) + """, deferred_dep_ids) + row = cur.fetchone() + if row and row[0] is not None: + batch_id = row[0] + dep_count += 1 + else: + # Deferred deps exist but none in batch_features (edge case) + batch_id = get_orphan_batch(cur, test_go_file) + orphan_count += 1 + + cur.execute( + "INSERT INTO batch_tests (batch_id, test_id) VALUES (?, ?)", + (batch_id, test_id), + ) + + print(f" Batch 0 (implementable): {batch_0_count}") + print(f" By dependency: {dep_count}") + print(f" Orphans (by file): {orphan_count}") + + +def update_counts(cur): + """Update feature_count and test_count on each batch.""" + cur.execute(""" + UPDATE implementation_batches SET + feature_count = ( + SELECT COUNT(*) FROM batch_features + WHERE batch_id = implementation_batches.id + ), + test_count = ( + SELECT COUNT(*) FROM batch_tests + WHERE batch_id = implementation_batches.id + ) + """) + + +def print_summary(cur): + """Print a summary report.""" + print() + print("=" * 80) + print("BATCH PLANNER SUMMARY") + print("=" * 80) + + cur.execute(""" + SELECT id, name, feature_count, test_count, depends_on + FROM implementation_batches ORDER BY id + """) + rows = cur.fetchall() + + total_features = 0 + total_tests = 0 + + print(f"\n{'ID':>3} {'Name':<35} {'Feats':>5} {'Tests':>5} {'Depends':>15}") + print("-" * 70) + + for bid, name, fc, tc, deps in rows: + total_features += fc + total_tests += tc + deps_str = deps if deps else "-" + print(f"{bid:>3} {name:<35} {fc:>5} {tc:>5} {deps_str:>15}") + + print("-" * 70) + print(f"{'':>3} {'TOTAL':<35} {total_features:>5} {total_tests:>5}") + + # Verification + cur.execute(""" + SELECT COUNT(*) FROM features + WHERE status = 'deferred' + AND id NOT IN (SELECT feature_id FROM batch_features) + """) + unassigned_features = cur.fetchone()[0] + + cur.execute(""" + SELECT COUNT(*) FROM unit_tests + WHERE status = 'deferred' + AND id NOT IN (SELECT test_id FROM batch_tests) + """) + unassigned_tests = cur.fetchone()[0] + + print(f"\nUnassigned deferred features: {unassigned_features}") + print(f"Unassigned deferred tests: {unassigned_tests}") + + if unassigned_features == 0 and unassigned_tests == 0: + print("\nAll deferred items assigned to batches.") + else: + print("\nWARNING: Some items remain unassigned!") + if unassigned_features > 0: + cur.execute(""" + SELECT go_file, COUNT(*) FROM features + WHERE status = 'deferred' + AND id NOT IN (SELECT feature_id FROM batch_features) + GROUP BY go_file + """) + for go_file, cnt in cur.fetchall(): + print(f" Unassigned features in {go_file}: {cnt}") + + # Spot-check: raft.shutdown + cur.execute(""" + SELECT bf.batch_id, f.go_method FROM batch_features bf + JOIN features f ON bf.feature_id = f.id + WHERE f.go_method = 'shutdown' AND f.go_class = 'raft' + """) + raft_shutdown = cur.fetchall() + if raft_shutdown: + print(f"\nSpot-check: raft.shutdown -> batch {raft_shutdown[0][0]}") + else: + print("\nSpot-check: raft.shutdown not found in deferred features") + + +def main(): + if not DB_SOURCE.exists(): + print(f"Error: {DB_SOURCE} not found", file=sys.stderr) + sys.exit(1) + + # Step 1: Copy database + print(f"Copying {DB_SOURCE} -> {DB_TARGET}") + shutil.copy2(DB_SOURCE, DB_TARGET) + + conn = sqlite3.connect(str(DB_TARGET)) + cur = conn.cursor() + cur.execute("PRAGMA foreign_keys = ON") + + # Step 2: Create new tables + print("Creating batch tables...") + cur.executescript(NEW_TABLES_SQL) + + # Step 3: Insert batch metadata + print("Inserting batch metadata...") + for bid, name, desc, priority, deps, go_files in BATCH_META: + cur.execute( + "INSERT INTO implementation_batches " + "(id, name, description, priority, depends_on, go_files) " + "VALUES (?, ?, ?, ?, ?, ?)", + (bid, name, desc, priority, deps, go_files), + ) + + # Step 4: Assign features + print("Assigning features to batches...") + assign_all_features(cur) + + # Step 5: Assign tests + print("Assigning tests to batches...") + assign_tests(cur) + + # Step 6: Update counts + print("Updating batch counts...") + update_counts(cur) + + conn.commit() + + # Step 7: Print summary + print_summary(cur) + + conn.close() + print(f"\nDone. Output: {DB_TARGET}") + + +if __name__ == "__main__": + main()