diff --git a/testing.go b/testing.go index 35ce4f0a39..63dedc259e 100644 --- a/testing.go +++ b/testing.go @@ -20,6 +20,12 @@ var errAlreadyInProgress = regexp.MustCompile(`removal of container .* is alread // This is a function designed to be used in your test, when Docker is not mandatory for CI/CD. // In this way tests that depend on Testcontainers won't run if the provider is provisioned correctly. func SkipIfProviderIsNotHealthy(t *testing.T) { + defer func() { + if r := recover(); r != nil { + t.Skipf("Recovered from panic. Docker is not running. TestContainers can't perform is work without it") + } + }() + t.Helper() ctx := context.Background() provider, err := ProviderDocker.GetProvider()