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:
Andrew Keesler
2020-08-05 14:15:45 -07:00
committed by Ryan Richard
parent 2b573d8642
commit da5b509cc6
3 changed files with 666 additions and 32 deletions
-32
View File
@@ -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())
}