2024-07-30 14:28:39 +02:00
|
|
|
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 {
|
2024-08-02 10:37:19 +02:00
|
|
|
t.Logf("Running integration tests. To disable, set environment variable %s=true", skipIntegrationTestsEnv)
|
2024-07-30 14:28:39 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
t.Skipf("Integration tests skipped. To enable, set environment variable %s=false", skipIntegrationTestsEnv)
|
|
|
|
}
|