test(batch7): implement t3 cross-cutting mapped tests

This commit is contained in:
Joseph Doherty
2026-02-28 11:32:36 -05:00
parent 007122a659
commit efc0d642b1
4 changed files with 144 additions and 0 deletions

View File

@@ -348,6 +348,62 @@ public sealed class NatsServerTests
"TestServerConfigLastLineComments".ShouldNotBeNullOrWhiteSpace();
}
[Fact] // T:2904
public void ServerClusterAndGatewayNameNoSpace_ShouldSucceed()
{
var serverNameErrors = new List<Exception>();
var warnings = new List<Exception>();
var parseOptions = new ServerOptions();
parseOptions.ProcessConfigFileLine("server_name", "my server", serverNameErrors, warnings);
serverNameErrors.ShouldContain(ServerErrors.ErrServerNameHasSpaces);
var (serverWithSpacedName, serverNameError) = NatsServer.NewServer(new ServerOptions
{
ServerName = "my server",
});
serverWithSpacedName.ShouldBeNull();
serverNameError.ShouldNotBeNull();
serverNameError.Message.ShouldContain("server name cannot contain spaces");
var clusterErrors = new List<Exception>();
ServerOptions.ParseCluster(
new Dictionary<string, object?>
{
["port"] = -1L,
["name"] = "my cluster",
},
new ServerOptions(),
clusterErrors,
warnings: null);
clusterErrors.Count.ShouldBeGreaterThanOrEqualTo(1);
clusterErrors[^1].Message.ShouldContain(ServerErrors.ErrClusterNameHasSpaces.Message);
var (clusterServer, clusterError) = NatsServer.NewServer(new ServerOptions
{
Cluster = new ClusterOpts
{
Name = "my cluster",
Port = -1,
},
});
clusterServer.ShouldBeNull();
clusterError.ShouldBeSameAs(ServerErrors.ErrClusterNameHasSpaces);
var gatewayErrors = new List<Exception>();
ServerOptions.ParseGateway(
new Dictionary<string, object?>
{
["port"] = -1L,
["name"] = "my gateway",
},
new ServerOptions(),
gatewayErrors,
warnings: null);
gatewayErrors.Count.ShouldBe(1);
gatewayErrors[0].Message.ShouldContain(ServerErrors.ErrGatewayNameHasSpaces.Message);
}
[Fact] // T:2905
public void ServerClientURL_ShouldSucceed()
{