Add integration tests for JetStreamEventStore

This commit adds comprehensive integration tests for JetStreamEventStore
that validate production event store behavior against a real NATS server.

Tests include:
- Stream creation and configuration
- SaveEvent persistence to JetStream
- GetEvents retrieval in correct order
- GetLatestVersion functionality
- Snapshot save/load operations
- Namespace isolation between stores
- Concurrent writes and version conflict handling
- Persistence across connection disconnects
- Multiple store instance coordination

Also updates CI workflow to run integration tests with a NATS server
enabled with JetStream.

Closes #10

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-10 23:49:14 +01:00
parent e66fa40b3a
commit 7085c682c3
2 changed files with 1455 additions and 0 deletions

View File

@@ -17,3 +17,33 @@ jobs:
run: go build ./...
- name: Test
run: go test ./...
integration:
runs-on: ubuntu-latest
services:
nats:
image: nats:latest
options: --name nats -p 4222:4222
# Enable JetStream via command line args
# Note: The 'args' field may not be supported in all CI runners
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Install NATS Server
run: |
# Download and install nats-server
curl -L https://github.com/nats-io/nats-server/releases/download/v2.10.24/nats-server-v2.10.24-linux-amd64.tar.gz -o nats-server.tar.gz
tar -xzf nats-server.tar.gz
sudo mv nats-server-v2.10.24-linux-amd64/nats-server /usr/local/bin/
nats-server --version
- name: Start NATS with JetStream
run: |
nats-server -js -p 4222 &
# Wait for NATS to be ready
sleep 3
# Verify NATS is running
curl -s http://localhost:8222/healthz || echo "Health check not available, but NATS may still be running"
- name: Run Integration Tests
run: go test -tags=integration -v ./...

File diff suppressed because it is too large Load Diff