feat: initial commit
This commit is contained in:
30
reach/integration.go
Normal file
30
reach/integration.go
Normal file
@ -0,0 +1,30 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user