- HighThroughput: Start consuming events in goroutine BEFORE publishing
to avoid buffer overflow (100-event buffer was filling up, dropping 900 events)
- EventOrdering: Handle both int (local delivery) and float64 (JSON/NATS delivery)
types for sequence field assertion
- ConcurrentPublishSubscribe: Same fix as HighThroughput - consume concurrently
The EventBus uses non-blocking sends with a 100-event buffer. When publishing
faster than consuming, events are silently dropped. These tests now properly
consume events concurrently to prevent buffer overflow.
Closes#138
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace deprecated '// +build integration' with modern '//go:build integration' syntax.
The old syntax was not recognized by Go 1.17+ build system, preventing integration
tests from being executed in CI/CD pipelines.
Closes#138
Co-Authored-By: Claude Code <noreply@anthropic.com>
The integration tests had timing issues causing intermittent failures on CI:
- TestNATSEventBus_HighThroughput: Added subscriber readiness synchronization using a barrier event before bulk publishing. This ensures the NATS subscription is fully established before events are sent rapidly. Extended timeout from 30s to 60s for CI environments.
- TestNATSEventBus_EventOrdering: Added readiness barrier event to synchronize subscriber setup before publishing ordered events. Extended timeout from 10s to 15s to account for CI timing variations.
- TestNATSEventBus_ConcurrentPublishSubscribe: Added readiness synchronization before concurrent publishers start. Extended timeout from 10s to 30s to handle the increased load under CI constraints.
Root causes:
- Subscriber channels were not fully ready to receive when bulk publishing started, causing message loss
- CI runners (especially ARM64) have different timing characteristics than local development
- Insufficient timeouts for high-volume event collection under shared CI resources
The fixes use a barrier pattern: publish a ready signal, wait to receive it, then proceed with the test. This is more reliable than fixed sleep durations.
Closes#57
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive integration tests that verify NATSEventBus behavior
with a real NATS server. Tests cover:
- Cross-node event delivery (multiple NATSEventBus instances)
- Namespace isolation with single and multiple NATS connections
- High-throughput scenarios (1000 events)
- Event ordering within namespace
- No cross-namespace leakage verification
- Concurrent publish/subscribe operations
- Multiple subscribers to same namespace
- Event metadata preservation across NATS
- Large event payload handling (100KB)
- Subscribe/unsubscribe lifecycle
- Reconnection behavior
- Graceful degradation under load
- Benchmarks for publish and publish-receive
Tests require a running NATS server and are tagged with +build integration.
Run with: go test -tags=integration -v ./...
Closes#18
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>