32 lines
822 B
Go
32 lines
822 B
Go
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 {
|
|
t.Logf("Running integration tests. To disable, set environment variable %s=true", skipIntegrationTestsEnv)
|
|
return
|
|
}
|
|
|
|
t.Skipf("Integration tests skipped. To enable, set environment variable %s=false", skipIntegrationTestsEnv)
|
|
}
|