From 364329cc1e58f5a77b4373f8bd86293fb20bf95d Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 26 Feb 2026 19:07:44 -0500 Subject: [PATCH] =?UTF-8?q?feat(p7-04):=20fill=20auth=20&=20config-check?= =?UTF-8?q?=20stubs=20=E2=80=94=201=20written,=2039=20deferred?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit auth_test.go (6): T:153 GetAuthErrClosedState written as pure unit test; T:147/149-152 use RunServer/RunServerWithConfig → deferred. auth_callout_test.go (31): all use NewAuthTest (RunServer) → all deferred. config_check_test.go (3): depend on Go .conf-format parser not yet ported → deferred. Adds 7 new test methods to AuthHandlerTests; suite grows 638→645. --- .../Auth/AuthHandlerTests.cs | 65 ++++++++++++++++++ porting.db | Bin 3395584 -> 3395584 bytes reports/current.md | 10 +-- reports/report_91f86b9.md | 40 +++++++++++ 4 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 reports/report_91f86b9.md diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/AuthHandlerTests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/AuthHandlerTests.cs index 4c1c048..c950e55 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/AuthHandlerTests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/AuthHandlerTests.cs @@ -12,6 +12,7 @@ // limitations under the License. using Shouldly; +using ZB.MOM.NatsNet.Server; using ZB.MOM.NatsNet.Server.Auth; namespace ZB.MOM.NatsNet.Server.Tests.Auth; @@ -381,4 +382,68 @@ public class AuthHandlerTests { AuthHandler.ConnectionTypes.IsKnown(ct).ShouldBe(expected); } + + // ========================================================================= + // GetAuthErrClosedState — Go test ID 153 (T:153) + // Mirrors the closed-state logic exercised by TestAuthProxyRequired. + // (The full Go test is server-dependent; this covers the pure unit subset.) + // ========================================================================= + + /// + /// Mirrors the proxy-required branch of TestAuthProxyRequired (T:153). + /// + [Fact] // T:153 + public void GetAuthErrClosedState_ProxyRequired_ReturnsProxyRequired() + { + var state = AuthHandler.GetAuthErrClosedState(new AuthProxyRequiredException()); + state.ShouldBe(ClosedState.ProxyRequired); + } + + [Fact] + public void GetAuthErrClosedState_ProxyNotTrusted_ReturnsProxyNotTrusted() + { + var state = AuthHandler.GetAuthErrClosedState(new AuthProxyNotTrustedException()); + state.ShouldBe(ClosedState.ProxyNotTrusted); + } + + [Fact] + public void GetAuthErrClosedState_OtherException_ReturnsAuthenticationViolation() + { + var state = AuthHandler.GetAuthErrClosedState(new InvalidOperationException("bad")); + state.ShouldBe(ClosedState.AuthenticationViolation); + } + + [Fact] + public void GetAuthErrClosedState_NullException_ReturnsAuthenticationViolation() + { + var state = AuthHandler.GetAuthErrClosedState(null); + state.ShouldBe(ClosedState.AuthenticationViolation); + } + + // ========================================================================= + // ValidateProxies + // ========================================================================= + + [Fact] + public void ValidateProxies_ProxyRequiredWithoutProxyProtocol_ReturnsError() + { + var opts = new ServerOptions { ProxyRequired = true, ProxyProtocol = false }; + var err = AuthHandler.ValidateProxies(opts); + err.ShouldNotBeNull(); + err!.Message.ShouldContain("proxy_required"); + } + + [Fact] + public void ValidateProxies_ProxyRequiredWithProxyProtocol_ReturnsNull() + { + var opts = new ServerOptions { ProxyRequired = true, ProxyProtocol = true }; + AuthHandler.ValidateProxies(opts).ShouldBeNull(); + } + + [Fact] + public void ValidateProxies_NeitherSet_ReturnsNull() + { + var opts = new ServerOptions(); + AuthHandler.ValidateProxies(opts).ShouldBeNull(); + } } diff --git a/porting.db b/porting.db index 96f9e57391e2c5e92a84a6bac1e45071713bf140..4e1ba216fa588ecbe852db78144077521821f6b7 100644 GIT binary patch delta 3963 zcmZWsX;2kc7Vf^c_vO8o<%u8&wB4d8f{3__ao4yHMih6+xP$u!LNm_|jiqt9Iy2>{ zWm%e}j9Mm-iY6}QI9ZI_IF2==&Pb`rWQYM=~x@1tzb zCAy3tNC!a>2ALomD+o&(w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