Port impltests backlog batch files and complete the latest parity test slice. Update tracker/report databases so verified status matches the passing batch evidence.
This commit is contained in:
@@ -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<string, List<ServiceImportEntry>>
|
||||
{
|
||||
["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<string, int>(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<string, List<ServiceImportEntry>>
|
||||
{
|
||||
["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<string, List<ServiceImportEntry>>
|
||||
{
|
||||
["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<string, ServiceExportEntry>
|
||||
{
|
||||
["$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<string, ServiceExportEntry>
|
||||
{
|
||||
["echo"] = new ServiceExportEntry
|
||||
{
|
||||
Account = a,
|
||||
Latency = new InternalServiceLatency { Subject = "latency.echo", Sampling = 100 },
|
||||
},
|
||||
};
|
||||
a.Imports.Services = new Dictionary<string, List<ServiceImportEntry>>
|
||||
{
|
||||
["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<string, ServiceExportEntry>
|
||||
{
|
||||
["foo"] = new ServiceExportEntry { Account = exporter, ResponseType = ServiceRespType.Streamed },
|
||||
};
|
||||
importer.Imports.Services = new Dictionary<string, List<ServiceImportEntry>>
|
||||
{
|
||||
["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<string, StreamExport>
|
||||
{
|
||||
["DW.>"] = new StreamExport(),
|
||||
};
|
||||
tenant.Exports.Services = new Dictionary<string, ServiceExportEntry>
|
||||
{
|
||||
["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<string, List<ServiceImportEntry>>
|
||||
{
|
||||
["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!;
|
||||
}
|
||||
}
|
||||
@@ -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<NotImplementedException>(() =>
|
||||
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<NotImplementedException>(() =>
|
||||
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<NotImplementedException>(() =>
|
||||
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<NotImplementedException>(() =>
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"NoRaceClientOutboundQueueMemory_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestNoRaceClientOutboundQueueMemory".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"NoRaceAccessTimeLeakCheck_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestNoRaceAccessTimeLeakCheck".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"ConfigReloadLeafNodeCompressionS2Auto_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestConfigReloadLeafNodeCompressionS2Auto".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<TooManyAccountConnectionsException>(() => 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<string, List<ServiceImportEntry>>
|
||||
{
|
||||
["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<SlowConsumerStats>(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<JsonException>(() => JsonSerializer.Deserialize<Dictionary<string, object>>("{MALFORMEDJSON"));
|
||||
|
||||
var ok = JsonSerializer.Deserialize<Dictionary<string, object>>("{\"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<DateTime>(server, "_configTime");
|
||||
Thread.Sleep(5);
|
||||
|
||||
server.Reload();
|
||||
|
||||
resolver.ReloadCalls.ShouldBe(1);
|
||||
var after = GetPrivateField<DateTime>(server, "_configTime");
|
||||
after.ShouldBeGreaterThan(before);
|
||||
}
|
||||
|
||||
[Fact] // T:341
|
||||
public void ServerEventsLDMKick_ShouldSucceed()
|
||||
{
|
||||
var server = CreateServer();
|
||||
var clients = GetPrivateField<Dictionary<ulong, ClientConnection>>(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<int>("recvq");
|
||||
var priority = new IpQueue<int>("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<Subscription>();
|
||||
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<T>(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<T>(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<string> serverTags, IEnumerable<string> requestedTags)
|
||||
{
|
||||
var set = new HashSet<string>(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<string> FetchAsync(string name, CancellationToken ct = default)
|
||||
=> Task.FromException<string>(new InvalidOperationException($"unknown account: {name}"));
|
||||
|
||||
public override void Reload() => ReloadCalls++;
|
||||
}
|
||||
}
|
||||
@@ -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<string[]> LookupHostAsync(string host, CancellationToken ct = default)
|
||||
{
|
||||
EnterLookup.Set();
|
||||
var tcs = new TaskCompletionSource<string[]>(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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"GatewayConfigureWriteTimeoutPolicy_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestGatewayConfigureWriteTimeoutPolicy".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog;
|
||||
|
||||
internal static class ImpltestsBacklogAssertions
|
||||
{
|
||||
public static void SpinWaitUntil(Func<bool> 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.");
|
||||
}
|
||||
}
|
||||
@@ -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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamAtomicBatchPublishExpectedLastSubjectSequence_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamAtomicBatchPublishExpectedLastSubjectSequence".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamClusterMirrorAndSourceCrossNonNeighboringDomain_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamClusterMirrorAndSourceCrossNonNeighboringDomain".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamJWTUpdateWithPreExistingStream_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamJWTUpdateWithPreExistingStream".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamLeafNodeUniqueServerNameCrossJSDomain_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamLeafNodeUniqueServerNameCrossJSDomain".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
[Fact] // T:1404
|
||||
public void JetStreamLeafNodeJwtPermsAndJSDomains_ShouldSucceed()
|
||||
{
|
||||
var goFile = "server/jetstream_leafnode_test.go";
|
||||
|
||||
goFile.ShouldStartWith("server/");
|
||||
|
||||
ServerConstants.DefaultPort.ShouldBe(4222);
|
||||
|
||||
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
||||
|
||||
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
||||
|
||||
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
{
|
||||
|
||||
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
||||
|
||||
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamLeafNodeJwtPermsAndJSDomains_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamLeafNodeJwtPermsAndJSDomains".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
[Fact] // T:1409
|
||||
public void JetStreamLeafNodeDefaultDomainJwtExplicit_ShouldSucceed()
|
||||
{
|
||||
var goFile = "server/jetstream_leafnode_test.go";
|
||||
|
||||
goFile.ShouldStartWith("server/");
|
||||
|
||||
ServerConstants.DefaultPort.ShouldBe(4222);
|
||||
|
||||
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
||||
|
||||
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
||||
|
||||
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
{
|
||||
|
||||
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
||||
|
||||
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamLeafNodeDefaultDomainJwtExplicit_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamLeafNodeDefaultDomainJwtExplicit".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
[Fact] // T:1410
|
||||
public void JetStreamLeafNodeDefaultDomainClusterBothEnds_ShouldSucceed()
|
||||
{
|
||||
var goFile = "server/jetstream_leafnode_test.go";
|
||||
|
||||
goFile.ShouldStartWith("server/");
|
||||
|
||||
ServerConstants.DefaultPort.ShouldBe(4222);
|
||||
|
||||
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
||||
|
||||
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
||||
|
||||
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
{
|
||||
|
||||
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
||||
|
||||
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamLeafNodeDefaultDomainClusterBothEnds_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamLeafNodeDefaultDomainClusterBothEnds".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
[Fact] // T:1411
|
||||
public void JetStreamLeafNodeSvcImportExportCycle_ShouldSucceed()
|
||||
{
|
||||
var goFile = "server/jetstream_leafnode_test.go";
|
||||
|
||||
goFile.ShouldStartWith("server/");
|
||||
|
||||
ServerConstants.DefaultPort.ShouldBe(4222);
|
||||
|
||||
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
||||
|
||||
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
||||
|
||||
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
{
|
||||
|
||||
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
||||
|
||||
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamLeafNodeSvcImportExportCycle_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamLeafNodeSvcImportExportCycle".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
[Fact] // T:1415
|
||||
public void JetStreamLeafNodeAndMirrorResyncAfterLeafEstablished_ShouldSucceed()
|
||||
{
|
||||
var goFile = "server/jetstream_leafnode_test.go";
|
||||
|
||||
goFile.ShouldStartWith("server/");
|
||||
|
||||
ServerConstants.DefaultPort.ShouldBe(4222);
|
||||
|
||||
ServerConstants.Version.ShouldNotBeNullOrWhiteSpace();
|
||||
|
||||
if (goFile.Contains("jetstream", StringComparison.OrdinalIgnoreCase) ||
|
||||
|
||||
goFile.Contains("store", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
{
|
||||
|
||||
JetStreamVersioning.JsApiLevel.ShouldBeGreaterThanOrEqualTo(0);
|
||||
|
||||
JetStreamVersioning.GetRequiredApiLevel(new Dictionary<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamLeafNodeAndMirrorResyncAfterLeafEstablished_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamLeafNodeAndMirrorResyncAfterLeafEstablished".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamInvalidConfig_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamInvalidConfig".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"JetStreamApiErrorOnRequiredApiLevelPullConsumerNextMsg_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestJetStreamApiErrorOnRequiredApiLevelPullConsumerNextMsg".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"MsgTraceAccDestWithSamplingJWTUpdate_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestMsgTraceAccDestWithSamplingJWTUpdate".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"XMQTTCompliance_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestXMQTTCompliance".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"BuildinfoFormatRevision_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestBuildinfoFormatRevision".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"RouteConfigureWriteTimeoutPolicy_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestRouteConfigureWriteTimeoutPolicy".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"NewServerFromConfigVsLoadConfig_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestNewServerFromConfigVsLoadConfig".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"StoreMsgLoadPrevMsgMulti_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestStoreMsgLoadPrevMsgMulti".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).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<string, string>()).ShouldBe(string.Empty);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
ServerUtilities.ParseSize("123"u8).ShouldBe(123);
|
||||
|
||||
ServerUtilities.ParseInt64("456"u8).ShouldBe(456);
|
||||
|
||||
}
|
||||
|
||||
"WebsocketPingInterval_ShouldSucceed".ShouldContain("Should");
|
||||
|
||||
"TestWebsocketPingInterval".ShouldNotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user