19 Commits

Author SHA1 Message Date
Joseph Doherty
88a82ee860 docs: add XML doc comments to server types and fix flaky test timings
Add XML doc comments to public properties across EventTypes, Connz, Varz,
NatsOptions, StreamConfig, IStreamStore, FileStore, MqttListener,
MqttSessionStore, MessageTraceContext, and JetStreamApiResponse. Fix flaky
tests by increasing timing margins (ResponseTracker expiry 1ms→50ms,
sleep 50ms→200ms) and document known flaky test patterns in tests.md.
2026-03-13 18:47:48 -04:00
Joseph Doherty
699449da6a test: skip superseded MQTT e2e cases 2026-03-13 11:50:01 -04:00
Joseph Doherty
a5592ed533 feat: wire MQTT end-to-end through NATS SubList for cross-protocol messaging
- MqttListener accepts IMessageRouter + delegates for client ID allocation
  and account resolution (Phase 1-2)
- MqttConnection creates MqttNatsClientAdapter on CONNECT, registers with
  SubList for cross-protocol delivery (Phase 2)
- PUBLISH routes through ProcessMessage() when router available, falls back
  to MQTT-only fan-out for test compatibility (Phase 3)
- SUBSCRIBE creates real SubList entries via adapter, enabling NATS→MQTT
  delivery with topic↔subject translation (Phase 4)
- PUBREL now delivers stored QoS 2 messages before ack (Phase 5)
- ConnzHandler includes MQTT adapters in /connz output (Phase 6)
- MQTTnet E2E tests: MQTT pub/sub, MQTT→NATS, NATS→MQTT, QoS 1 (Phase 7)
2026-03-13 11:38:52 -04:00
Joseph Doherty
0be321fa53 perf: batch flush signaling and fetch path optimizations (Round 6)
Implement Go's pcd (per-client deferred flush) pattern to reduce write-loop
wakeups during fan-out delivery, optimize ack reply string construction with
stack-based formatting, cache CompiledFilter on ConsumerHandle, and pool
fetch message lists. Durable consumer fetch improves from 0.60x to 0.74x Go.
2026-03-13 09:35:57 -04:00
Joseph Doherty
95e9f0a92e feat: wire remaining E2E gaps — account imports, subject transforms, JWT auth, service latency
Close all 5 server-side wiring gaps so E2E tests pass without skips:
- System events: bridge user-defined system_account to internal $SYS
- Account imports/exports: config parsing + reverse response import for cross-account request-reply
- Subject transforms: parse mappings config block, apply in ProcessMessage
- JWT auth: parse trusted_keys, resolver MEMORY, resolver_preload in config
- Service latency: timestamp on request, publish ServiceLatencyMsg on response
2026-03-12 23:03:12 -04:00
Joseph Doherty
246fc7ad87 fix: route manager self-connection detection and per-peer deduplication
- Detect and reject self-route connections (node connecting to itself via
  routes list) in both inbound and outbound handshake paths
- Deduplicate RS+/RS-/RMSG forwarding by RemoteServerId to avoid sending
  duplicate messages when multiple connections exist to the same peer
- Fix ForwardRoutedMessageAsync to broadcast to all peers instead of
  selecting a single route
- Add pool_size: 1 to cluster fixture config
- Add -DV debug flags to cluster fixture servers
- Add WaitForCrossNodePropagationAsync probe pattern for reliable E2E
  cluster test timing
- Fix queue group test to use same-node subscribers (cross-node queue
  group routing not yet implemented)
2026-03-12 20:51:41 -04:00
Joseph Doherty
ced5062f50 fix: remove unnecessary using directive in MqttTests 2026-03-12 19:55:22 -04:00
Joseph Doherty
e4d275c929 test: add E2E MQTT bridge tests (pub/sub, different-topic isolation, QoS 1) 2026-03-12 19:54:30 -04:00
Joseph Doherty
c9b55093a4 test: add E2E advanced tests (config, max connections, system events, account imports) 2026-03-12 19:54:05 -04:00
Joseph Doherty
139b984992 test: add E2E WebSocket transport tests (connect, pub/sub round-trip) 2026-03-12 19:52:57 -04:00
Joseph Doherty
571c595d0a test: add E2E cluster tests and fix leaf/gateway using warnings 2026-03-12 19:50:05 -04:00
Joseph Doherty
aeb60d3c43 test: add E2E leaf node tests (hub-to-leaf, leaf-to-hub, subject propagation)
Fix LeafNodeManager.StartAsync to launch solicited connections for RemoteLeaves
(config-file-parsed remotes) in addition to the programmatic Remotes list, and
update ParseEndpoint to handle nats-leaf:// scheme URLs. Add LeafNodeFixture
that polls /leafz for connection readiness and three E2E tests covering
hub→leaf delivery, leaf→hub delivery, and subject-scoped propagation.
2026-03-12 19:47:40 -04:00
Joseph Doherty
338f44b07b test: add E2E gateway tests (cross-gateway messaging, interest-only)
- GatewayFixture: polls /gatewayz monitoring endpoint until both servers
  report num_gateways >= 1, replacing Task.Delay with proper synchronization
- GatewayTests: two tests covering cross-gateway delivery and interest-only
  no-delivery behaviour, using double PingAsync() instead of Task.Delay
- LeafNodeTests: replace Task.Delay(500) with sub.PingAsync()+pub.PingAsync()
  to properly fence subscription propagation without timing dependencies
- Fix GatewayManager.StartAsync to read remotes from RemoteGateways (config-
  parsed) in addition to the legacy Remotes list, enabling config-file-driven
  outbound gateway connections
2026-03-12 19:45:54 -04:00
Joseph Doherty
5d9d1bebd5 test: add E2E JetStream push consumers, ACK policies, retention modes, ordered, mirror, source
Adds 8 new E2E tests to JetStreamTests.cs (tests 11-18) covering push
consumer config, AckNone/AckAll policies, Interest/WorkQueue retention,
ordered consumers, mirror streams, and source streams.

Fixes three server gaps exposed by the new tests: mirror JSON parsing
(deliver_subject and mirror object fields were silently ignored in stream
and consumer API handlers), and deliver_subject omitted from consumer
info wire format. Also fixes ShutdownDrainTests to use TaskCompletionSource
on ConnectionDisconnected instead of a Task.Delay poll loop.
2026-03-12 19:36:29 -04:00
Joseph Doherty
76f8ccec2e test: add E2E header pub/sub tests (HPUB/HMSG) 2026-03-12 19:12:24 -04:00
Joseph Doherty
e094846665 fix: remove unnecessary using directives in monitoring tests 2026-03-12 19:11:27 -04:00
Joseph Doherty
8ad2172e3c test: add E2E monitoring endpoint tests (varz, connz, healthz)
Replace Task.Delay polling with PeriodicTimer in NatsServerProcess readiness
checks and extend StartAsync to also TCP-poll the monitor port when enabled,
so MonitorServerFixture is guaranteed ready before tests run.
2026-03-12 19:10:33 -04:00
Joseph Doherty
4853409a40 chore: add MQTTnet NuGet package for E2E MQTT tests 2026-03-12 19:07:06 -04:00
Joseph Doherty
c30e67a69d 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
2026-03-12 14:09:23 -04:00