package reach import ( "os" "strconv" "testing" "github.com/pkg/errors" ) const skipIntegrationTestsEnv = "SKIP_INTEGRATION_TESTS" func AssertIntegrationTests(t *testing.T) { rawSkipIntegrationTests := os.Getenv(skipIntegrationTestsEnv) if rawSkipIntegrationTests == "" { rawSkipIntegrationTests = "false" } skipIntegrationTests, err := strconv.ParseBool(rawSkipIntegrationTests) if err != nil { t.Logf("[WARN] could not parse environment variable '%s': %+v", skipIntegrationTestsEnv, errors.WithStack(err)) skipIntegrationTests = false } if !skipIntegrationTests { return } t.Skipf("Integration tests skipped. To enable, set environment variable %s=false", skipIntegrationTestsEnv) }