Files
galaxy-game/integration/testenv/skip.go
T
2026-05-06 10:14:55 +03:00

34 lines
1.0 KiB
Go

// Package testenv builds and tears down an end-to-end Galaxy stack
// (Postgres, Redis, mailpit, backend, gateway, optionally a game-engine
// container) for use by the integration test suite. Tests interact with
// the platform exclusively through the typed clients exposed here; no
// other package in this module reaches the underlying containers
// directly.
package testenv
import (
"context"
"testing"
"time"
"github.com/testcontainers/testcontainers-go"
)
// RequireDocker skips the test when no Docker daemon is reachable. Each
// scenario starts with this guard so a CI worker without Docker emits a
// clear SKIP rather than a confusing failure.
func RequireDocker(t *testing.T) {
t.Helper()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
provider, err := testcontainers.NewDockerProvider()
if err != nil {
t.Skipf("docker provider unavailable: %v", err)
return
}
defer provider.Close()
if err := provider.Health(ctx); err != nil {
t.Skipf("docker daemon unreachable: %v", err)
}
}