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>
50 lines
1.5 KiB
YAML
50 lines
1.5 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23'
|
|
- name: Build
|
|
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 ./...
|