feat(p7-04): fill auth & config-check stubs — 1 written, 39 deferred
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.
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
|
using ZB.MOM.NatsNet.Server;
|
||||||
using ZB.MOM.NatsNet.Server.Auth;
|
using ZB.MOM.NatsNet.Server.Auth;
|
||||||
|
|
||||||
namespace ZB.MOM.NatsNet.Server.Tests.Auth;
|
namespace ZB.MOM.NatsNet.Server.Tests.Auth;
|
||||||
@@ -381,4 +382,68 @@ public class AuthHandlerTests
|
|||||||
{
|
{
|
||||||
AuthHandler.ConnectionTypes.IsKnown(ct).ShouldBe(expected);
|
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.)
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mirrors the proxy-required branch of TestAuthProxyRequired (T:153).
|
||||||
|
/// </summary>
|
||||||
|
[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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
porting.db
BIN
porting.db
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
# NATS .NET Porting Status Report
|
# NATS .NET Porting Status Report
|
||||||
|
|
||||||
Generated: 2026-02-27 00:04:02 UTC
|
Generated: 2026-02-27 00:07:45 UTC
|
||||||
|
|
||||||
## Modules (12 total)
|
## Modules (12 total)
|
||||||
|
|
||||||
@@ -21,11 +21,11 @@ Generated: 2026-02-27 00:04:02 UTC
|
|||||||
|
|
||||||
| Status | Count |
|
| Status | Count |
|
||||||
|--------|-------|
|
|--------|-------|
|
||||||
| complete | 208 |
|
| complete | 209 |
|
||||||
| deferred | 162 |
|
| deferred | 201 |
|
||||||
| n_a | 187 |
|
| n_a | 187 |
|
||||||
| not_started | 2527 |
|
| not_started | 2527 |
|
||||||
| stub | 59 |
|
| stub | 19 |
|
||||||
| verified | 114 |
|
| verified | 114 |
|
||||||
|
|
||||||
## Library Mappings (36 total)
|
## Library Mappings (36 total)
|
||||||
@@ -37,4 +37,4 @@ Generated: 2026-02-27 00:04:02 UTC
|
|||||||
|
|
||||||
## Overall Progress
|
## Overall Progress
|
||||||
|
|
||||||
**4193/6942 items complete (60.4%)**
|
**4194/6942 items complete (60.4%)**
|
||||||
|
|||||||
40
reports/report_91f86b9.md
Normal file
40
reports/report_91f86b9.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# NATS .NET Porting Status Report
|
||||||
|
|
||||||
|
Generated: 2026-02-27 00:07:45 UTC
|
||||||
|
|
||||||
|
## Modules (12 total)
|
||||||
|
|
||||||
|
| Status | Count |
|
||||||
|
|--------|-------|
|
||||||
|
| not_started | 1 |
|
||||||
|
| verified | 11 |
|
||||||
|
|
||||||
|
## Features (3673 total)
|
||||||
|
|
||||||
|
| Status | Count |
|
||||||
|
|--------|-------|
|
||||||
|
| complete | 3368 |
|
||||||
|
| n_a | 26 |
|
||||||
|
| verified | 279 |
|
||||||
|
|
||||||
|
## Unit Tests (3257 total)
|
||||||
|
|
||||||
|
| Status | Count |
|
||||||
|
|--------|-------|
|
||||||
|
| complete | 209 |
|
||||||
|
| deferred | 201 |
|
||||||
|
| n_a | 187 |
|
||||||
|
| not_started | 2527 |
|
||||||
|
| stub | 19 |
|
||||||
|
| verified | 114 |
|
||||||
|
|
||||||
|
## Library Mappings (36 total)
|
||||||
|
|
||||||
|
| Status | Count |
|
||||||
|
|--------|-------|
|
||||||
|
| mapped | 36 |
|
||||||
|
|
||||||
|
|
||||||
|
## Overall Progress
|
||||||
|
|
||||||
|
**4194/6942 items complete (60.4%)**
|
||||||
Reference in New Issue
Block a user