mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-09-06 16:17:08 +00:00
Stop using $PLACEHOLDER_NAME_TEST_INTEGRATION
Instead, make the integration tests a separate module. You can't run these tests by accident because they will not run at all when you `go test` from the top-level directory. You will need to `cd test` before using `go test` in order to run the integration tests. Signed-off-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
committed by
Ryan Richard
parent
2b573d8642
commit
da5b509cc6
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
Copyright 2020 VMware, Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// force users to opt-in to running the integration tests.
|
||||
// this prevents them from running if someone does `go test ./...`
|
||||
// these tests could be destructive to the cluster under test.
|
||||
const magicIntegrationTestsEnvVar = "PLACEHOLDER_NAME_TEST_INTEGRATION"
|
||||
|
||||
var shouldRunIntegrationTests = func() bool {
|
||||
b, _ := strconv.ParseBool(os.Getenv(magicIntegrationTestsEnvVar))
|
||||
return b
|
||||
}()
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
if !shouldRunIntegrationTests {
|
||||
fmt.Printf("SKIP: %s=true env var must be explicitly set for integration tests to run\n", magicIntegrationTestsEnvVar)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
Reference in New Issue
Block a user