Fix E2E test gaps and add comprehensive E2E + parity test suites

- Fix pull consumer fetch: send original stream subject in HMSG (not inbox)
  so NATS client distinguishes data messages from control messages
- Fix MaxAge expiry: add background timer in StreamManager for periodic pruning
- Fix JetStream wire format: Go-compatible anonymous objects with string enums,
  proper offset-based pagination for stream/consumer list APIs
- Add 42 E2E black-box tests (core messaging, auth, TLS, accounts, JetStream)
- Add ~1000 parity tests across all subsystems (gaps closure)
- Update gap inventory docs to reflect implementation status
This commit is contained in:
Joseph Doherty
2026-03-12 14:09:23 -04:00
parent 79c1ee8776
commit c30e67a69d
226 changed files with 17801 additions and 709 deletions

View File

@@ -104,15 +104,15 @@ Add rows to the Gap Inventory table below. Group by Go source file. Include the
| diskAvailable (solaris) | golang/nats-server/server/disk_avail_solaris.go:23 | NOT_APPLICABLE | N/A | Solaris/illumos stub; not supported platform for .NET |
| diskAvailable (wasm) | golang/nats-server/server/disk_avail_wasm.go:18 | NOT_APPLICABLE | N/A | WASM stub; .NET does not compile to WASM for NATS server |
| diskAvailable (windows) | golang/nats-server/server/disk_avail_windows.go:19 | PARTIAL | NatsServer.cs (JetStream disk checking stub) | .NET has minimal implementation; full Windows disk space API not used |
| SetServiceName | golang/nats-server/server/service_windows.go:34 | MISSING | N/A | .NET host app does not implement Windows service mode |
| winServiceWrapper.Execute | golang/nats-server/server/service_windows.go:64 | MISSING | N/A | .NET uses standard .NET Worker Service abstraction instead |
| Run (service) | golang/nats-server/server/service_windows.go:115 | MISSING | N/A | .NET app startup does not support Windows service wrapper |
| isWindowsService | golang/nats-server/server/service_windows.go:132 | MISSING | N/A | .NET does not expose Windows service detection |
| SetServiceName | golang/nats-server/server/service_windows.go:34 | NOT_APPLICABLE | src/NATS.Server.Host/Program.cs:125 | Windows-service naming and SCM registration are host-runtime concerns in .NET; the server host accepts `--service` but does not implement Go-specific wrapper APIs |
| winServiceWrapper.Execute | golang/nats-server/server/service_windows.go:64 | NOT_APPLICABLE | src/NATS.Server.Host/Program.cs:125 | Go Windows service wrapper is replaced by .NET host/service abstractions rather than server-embedded execute loop |
| Run (service) | golang/nats-server/server/service_windows.go:115 | NOT_APPLICABLE | src/NATS.Server.Host/Program.cs:125 | Service run-loop orchestration is delegated to host process model in .NET |
| isWindowsService | golang/nats-server/server/service_windows.go:132 | NOT_APPLICABLE | src/NATS.Server.Host/Program.cs:198 | .NET host startup chooses mode via CLI/environment instead of Go's wrapper detection helper |
| handleSignals (wasm) | golang/nats-server/server/signal_wasm.go:18 | NOT_APPLICABLE | N/A | WASM stub; .NET does not target WASM |
| ProcessSignal (wasm) | golang/nats-server/server/signal_wasm.go:22 | NOT_APPLICABLE | N/A | WASM stub; .NET does not target WASM |
| handleSignals (windows) | golang/nats-server/server/signal_windows.go:28 | PARTIAL | NatsServer.cs (event loop shutdown) | .NET uses CancellationToken instead of signal channels |
| ProcessSignal (windows) | golang/nats-server/server/signal_windows.go:53 | MISSING | N/A | .NET does not support remote signal commands to Windows services |
| reopenLogCode, ldmCode | golang/nats-server/server/service_windows.go:24-28 | PARTIAL | Host program configuration | .NET logging uses Serilog; log rotation not exposed as service commands |
| handleSignals (windows) | golang/nats-server/server/signal_windows.go:28 | NOT_APPLICABLE | src/NATS.Server/NatsServer.cs:376 | Go signal-channel model is replaced by host-native cancellation and managed signal hooks in .NET |
| ProcessSignal (windows) | golang/nats-server/server/signal_windows.go:53 | NOT_APPLICABLE | src/NATS.Server.Host/Program.cs:226 | Remote Windows service signal command processing is not part of .NET server architecture; shutdown/reopen flows are host-driven |
| reopenLogCode, ldmCode | golang/nats-server/server/service_windows.go:24-28 | NOT_APPLICABLE | src/NATS.Server/NatsServer.cs:119 | Service command codes are Go SCM-specific; .NET exposes equivalent operations via host callbacks (`ReOpenLogFile`, graceful shutdown) |
### Test Files — Miscellaneous
@@ -120,13 +120,13 @@ Add rows to the Gap Inventory table below. Group by Go source file. Include the
|-----------|:-------------|--------|:----------------|-------|
| TestPing | golang/nats-server/server/ping_test.go:34 | PORTED | tests/NATS.Server.Tests/ServerTests.cs:PingKeepaliveTests | Raw socket PING/PONG protocol test ported |
| DefaultPingOptions | golang/nats-server/server/ping_test.go:26 | PORTED | tests/NATS.Server.Tests/ServerTests.cs:PingKeepaliveTests | Test options reflected in C# test setup |
| TestClosedConnsAccounting | golang/nats-server/server/closed_conns_test.go:46 | PARTIAL | tests/NATS.Server.Tests/Monitoring/ClosedConnectionRingBufferTests.cs | Ring buffer implementation exists; not all closed-conn tracking tests ported |
| TestClosedConnsSubsAccounting | golang/nats-server/server/closed_conns_test.go:102 | PARTIAL | tests/NATS.Server.Tests/Monitoring/ClosedConnectionRingBufferTests.cs | Subscription tracking in closed conns; basic tests exist |
| TestClosedAuthorizationTimeout | golang/nats-server/server/closed_conns_test.go:143 | MISSING | N/A | Auth timeout closure tracking not fully tested |
| TestClosedAuthorizationViolation | golang/nats-server/server/closed_conns_test.go:164 | PARTIAL | tests/NATS.Server.Tests/Monitoring/MonitorGoParityTests.cs | Auth violation tracking partially tested |
| TestClosedUPAuthorizationViolation | golang/nats-server/server/closed_conns_test.go:187 | PARTIAL | tests/NATS.Server.Tests/Configuration/OptsGoParityTests.cs | Username/password auth failure tracking not fully tested |
| TestClosedMaxPayload | golang/nats-server/server/closed_conns_test.go:219 | MISSING | N/A | Max payload violation closure tracking not tested |
| TestClosedTLSHandshake | golang/nats-server/server/closed_conns_test.go:247 | MISSING | N/A | TLS handshake failure closure tracking not tested |
| TestClosedConnsAccounting | golang/nats-server/server/closed_conns_test.go:46 | PORTED | tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:489 | Closed-connection accounting parity covered: single closed client tracking, bounded ring behavior, and required closed-client fields/close-reason coverage. |
| TestClosedConnsSubsAccounting | golang/nats-server/server/closed_conns_test.go:102 | PORTED | tests/NATS.Server.Tests/Monitoring/MonitorGoParityTests.cs:1720 | Closed-connection subscription accounting parity covered via `/connz?state=closed&subs=detail` assertions and closed-conn subscription detail mapping tests. |
| TestClosedAuthorizationTimeout | golang/nats-server/server/closed_conns_test.go:143 | PORTED | tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:636 | `ClosedConns_auth_timeout_close_reason_tracked` validates auth-timeout close reason accounting |
| TestClosedAuthorizationViolation | golang/nats-server/server/closed_conns_test.go:164 | PORTED | tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:680 | `ClosedConns_auth_violation_close_reason_tracked` validates auth-violation close reason accounting |
| TestClosedUPAuthorizationViolation | golang/nats-server/server/closed_conns_test.go:187 | PORTED | tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:726 | Added explicit username/password auth-violation closed-connection parity test covering no-creds and wrong-password failures |
| TestClosedMaxPayload | golang/nats-server/server/closed_conns_test.go:219 | PORTED | tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:585 | `ClosedConns_max_payload_close_reason_tracked` validates max-payload close reason accounting |
| TestClosedTLSHandshake | golang/nats-server/server/closed_conns_test.go:247 | PORTED | src/NATS.Server/NatsServer.cs:1666; tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:784 | Added early-accept closed-client tracking for TLS negotiation failures (`TLS Handshake Error`) plus targeted parity test |
| NoRace tests (norace_1_test.go) | golang/nats-server/server/norace_1_test.go:1 | PARTIAL | tests/NATS.Server.Tests/Stress/ (2,342 LOC vs 8,497 Go LOC) | Long-running race/concurrency tests; ~27% mapped to .NET Stress tests |
| NoRace tests (norace_2_test.go) | golang/nats-server/server/norace_2_test.go:1 | PARTIAL | tests/NATS.Server.Tests/Stress/ | Additional race/concurrency scenarios; ~27% coverage in .NET |
| BenchmarkPublish | golang/nats-server/server/benchmark_publish_test.go:1 | DEFERRED | N/A | Go benchmarks not directly portable; .NET uses different perf tooling (BenchmarkDotNet) |
@@ -165,5 +165,7 @@ After porting work is completed:
| Date | Change | By |
|------|--------|----|
| 2026-02-26 | Reclassified closed-connection test parity rows to PORTED based on existing focused coverage for closed conn accounting and closed subscription detail endpoints. | codex |
| 2026-02-25 | Initial gap inventory analysis: 8 platform-specific source files, 14 test symbols, 35 integration tests | claude |
| 2026-02-25 | File created with LLM analysis instructions | auto |
| 2026-02-25 | Ported closed-connection parity for username/password auth violations and TLS handshake failures, including early TLS-failure closed-client tracking in accept path | codex |