All checks were successful
CI / build (pull_request) Successful in 1m28s
- Add UpdateVersionCache method to JetStreamEventStore for cache synchronization - Add SubscribeToEventStored convenience helper to NATSEventBus - Create integration tests for cross-node broadcasting scenarios - Add example demonstrating NATSEventBus + JetStreamEventStore integration
36 lines
723 B
Go
36 lines
723 B
Go
//go:build integration
|
|
// +build integration
|
|
|
|
package store
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/nats-io/nats.go"
|
|
)
|
|
|
|
// getTestNATSConnection returns a NATS connection for testing.
|
|
// This helper is used by benchmark tests that require NATS.
|
|
func getTestNATSConnection(t *testing.T) *nats.Conn {
|
|
nc, err := nats.Connect(nats.DefaultURL)
|
|
if err != nil {
|
|
t.Skipf("NATS not available: %v", err)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// getVersionFromEvent extracts version from EventStored event data.
|
|
func getVersionFromEvent(data map[string]interface{}) int64 {
|
|
switch v := data["version"].(type) {
|
|
case float64:
|
|
return int64(v)
|
|
case int64:
|
|
return v
|
|
case int:
|
|
return int64(v)
|
|
case uint64:
|
|
return int64(v)
|
|
default:
|
|
return 0
|
|
}
|
|
} |