24 lines
722 B
Go
24 lines
722 B
Go
|
|
package testutils
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
// SkipIfNoIntegration skips the current test when integration prerequisites
|
||
|
|
// (notably a running Docker daemon for testcontainers-go) are unavailable.
|
||
|
|
//
|
||
|
|
// It honors:
|
||
|
|
// - `go test -short` (testing.Short())
|
||
|
|
// - VEZA_SKIP_INTEGRATION=1 environment variable (set by CI runners
|
||
|
|
// without Docker socket access)
|
||
|
|
//
|
||
|
|
// Call this at the very top of any test helper that relies on
|
||
|
|
// GetTestContainerDB or otherwise spins up Postgres via testcontainers.
|
||
|
|
func SkipIfNoIntegration(t *testing.T) {
|
||
|
|
t.Helper()
|
||
|
|
if testing.Short() || os.Getenv("VEZA_SKIP_INTEGRATION") == "1" {
|
||
|
|
t.Skip("integration test requires Docker; skipped (-short or VEZA_SKIP_INTEGRATION=1)")
|
||
|
|
}
|
||
|
|
}
|