fix: session A — NoSystemAccount guard, MaxControlLine default, URL/TLS converter tests
This commit is contained in:
@@ -109,6 +109,9 @@ public static class ServerOptionsConfiguration
|
|||||||
// Apply default auth timeout.
|
// Apply default auth timeout.
|
||||||
if (opts.AuthTimeout == 0) opts.AuthTimeout = ServerConstants.DefaultAuthTimeout;
|
if (opts.AuthTimeout == 0) opts.AuthTimeout = ServerConstants.DefaultAuthTimeout;
|
||||||
|
|
||||||
|
// Apply default max control line size.
|
||||||
|
if (opts.MaxControlLine == 0) opts.MaxControlLine = ServerConstants.MaxControlLineSize;
|
||||||
|
|
||||||
// Ensure SystemAccount defaults if not set.
|
// Ensure SystemAccount defaults if not set.
|
||||||
ConfigureSystemAccount(opts);
|
ConfigureSystemAccount(opts);
|
||||||
}
|
}
|
||||||
@@ -121,6 +124,8 @@ public static class ServerOptionsConfiguration
|
|||||||
{
|
{
|
||||||
// If system account already set, nothing to do.
|
// If system account already set, nothing to do.
|
||||||
if (!string.IsNullOrEmpty(opts.SystemAccount)) return;
|
if (!string.IsNullOrEmpty(opts.SystemAccount)) return;
|
||||||
|
// Respect explicit opt-out.
|
||||||
|
if (opts.NoSystemAccount) return;
|
||||||
// Default to "$SYS" if not explicitly disabled.
|
// Default to "$SYS" if not explicitly disabled.
|
||||||
opts.SystemAccount = ServerConstants.DefaultSystemAccount;
|
opts.SystemAccount = ServerConstants.DefaultSystemAccount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="*" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="*" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="*" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="*" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="*" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="*" />
|
||||||
<PackageReference Include="BCrypt.Net-Next" Version="*" />
|
<PackageReference Include="BCrypt.Net-Next" Version="*" />
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Licensed under the Apache License, Version 2.0
|
// Licensed under the Apache License, Version 2.0
|
||||||
namespace ZB.MOM.NatsNet.Server.Tests.Config;
|
namespace ZB.MOM.NatsNet.Server.Tests.Config;
|
||||||
|
|
||||||
|
using System.Security.Authentication;
|
||||||
using ZB.MOM.NatsNet.Server.Config;
|
using ZB.MOM.NatsNet.Server.Config;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@@ -109,3 +110,40 @@ public class StorageSizeJsonConverterTests
|
|||||||
StorageSizeJsonConverter.Parse(input).ShouldBe(expectedBytes);
|
StorageSizeJsonConverter.Parse(input).ShouldBe(expectedBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class NatsUrlJsonConverterTests
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData("nats://localhost:4222", "nats://localhost:4222")]
|
||||||
|
[InlineData("localhost:4222", "nats://localhost:4222")]
|
||||||
|
[InlineData("localhost", "nats://localhost")]
|
||||||
|
public void Normalise_ValidUrls_NormalisesCorrectly(string input, string expected)
|
||||||
|
{
|
||||||
|
NatsUrlJsonConverter.Normalise(input).ShouldBe(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Normalise_EmptyString_ReturnsEmpty()
|
||||||
|
{
|
||||||
|
NatsUrlJsonConverter.Normalise(string.Empty).ShouldBe(string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TlsVersionJsonConverterTests
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData("1.2", SslProtocols.Tls12)]
|
||||||
|
[InlineData("TLS12", SslProtocols.Tls12)]
|
||||||
|
[InlineData("1.3", SslProtocols.Tls13)]
|
||||||
|
[InlineData("TLS13", SslProtocols.Tls13)]
|
||||||
|
public void Parse_ValidVersionStrings_ReturnsCorrectProtocol(string input, SslProtocols expected)
|
||||||
|
{
|
||||||
|
TlsVersionJsonConverter.Parse(input).ShouldBe(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Parse_InvalidVersion_ThrowsFormatException()
|
||||||
|
{
|
||||||
|
Should.Throw<FormatException>(() => TlsVersionJsonConverter.Parse("2.0"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# NATS .NET Porting Status Report
|
# NATS .NET Porting Status Report
|
||||||
|
|
||||||
Generated: 2026-02-26 22:18:29 UTC
|
Generated: 2026-02-26 22:29:06 UTC
|
||||||
|
|
||||||
## Modules (12 total)
|
## Modules (12 total)
|
||||||
|
|
||||||
|
|||||||
38
reports/report_9c1ffc0.md
Normal file
38
reports/report_9c1ffc0.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# NATS .NET Porting Status Report
|
||||||
|
|
||||||
|
Generated: 2026-02-26 22:29:06 UTC
|
||||||
|
|
||||||
|
## Modules (12 total)
|
||||||
|
|
||||||
|
| Status | Count |
|
||||||
|
|--------|-------|
|
||||||
|
| complete | 11 |
|
||||||
|
| not_started | 1 |
|
||||||
|
|
||||||
|
## Features (3673 total)
|
||||||
|
|
||||||
|
| Status | Count |
|
||||||
|
|--------|-------|
|
||||||
|
| complete | 3570 |
|
||||||
|
| n_a | 77 |
|
||||||
|
| stub | 26 |
|
||||||
|
|
||||||
|
## Unit Tests (3257 total)
|
||||||
|
|
||||||
|
| Status | Count |
|
||||||
|
|--------|-------|
|
||||||
|
| complete | 319 |
|
||||||
|
| n_a | 181 |
|
||||||
|
| not_started | 2533 |
|
||||||
|
| stub | 224 |
|
||||||
|
|
||||||
|
## Library Mappings (36 total)
|
||||||
|
|
||||||
|
| Status | Count |
|
||||||
|
|--------|-------|
|
||||||
|
| mapped | 36 |
|
||||||
|
|
||||||
|
|
||||||
|
## Overall Progress
|
||||||
|
|
||||||
|
**4158/6942 items complete (59.9%)**
|
||||||
Reference in New Issue
Block a user