Convert the controllerlib tests to use the same structure as our other integration tests.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer
2020-08-28 13:07:47 -05:00
parent a503fa8673
commit 1fcf95af01
4 changed files with 3 additions and 113 deletions
@@ -17,10 +17,12 @@ import (
"github.com/suzerain-io/pinniped/internal/controllerlib/test/integration/examplecontroller/api"
examplestart "github.com/suzerain-io/pinniped/internal/controllerlib/test/integration/examplecontroller/starter"
"github.com/suzerain-io/pinniped/internal/controllerlib/test/library"
"github.com/suzerain-io/pinniped/test/library"
)
func TestExampleController(t *testing.T) {
library.SkipUnlessIntegration(t)
config := library.NewClientConfig(t)
ctx, cancel := context.WithCancel(context.Background())
@@ -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 = "CONTROLLER_GO_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())
}