Skip to content

Commit

Permalink
Add flag to skip tests from running in live mode (#2443)
Browse files Browse the repository at this point in the history
  • Loading branch information
super-harsh committed Aug 11, 2022
1 parent 7d6bbb9 commit 5ac613d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Taskfile.yml
Expand Up @@ -321,7 +321,7 @@ tasks:
deps: [controller:run-kustomize-for-envtest, cleanup-azure-resources]
cmds:
# -race fails at the moment in controller-runtime
- go test -timeout {{.LIVE_TEST_TIMEOUT}} -covermode atomic -coverprofile=coverage-integration-envtest-live.out -coverpkg="./..." -run '{{default ".*" .TEST_FILTER}}' ./internal/controllers
- go test -timeout {{.LIVE_TEST_TIMEOUT}} -covermode atomic -coverprofile=coverage-integration-envtest-live.out -coverpkg="./..." -run '{{default ".*" .TEST_FILTER}}' ./internal/controllers -args -live
env:
RECORD_REPLAY: 0

Expand Down
5 changes: 5 additions & 0 deletions v2/internal/controllers/samples_test.go
Expand Up @@ -40,6 +40,11 @@ var randomNameExclusions = []string{

func Test_Samples_CreationAndDeletion(t *testing.T) {
t.Parallel()

if *isLive {
t.Skip("skipping test in live mode")
}

g := NewGomegaWithT(t)

regex, err := regexp.Compile("^v1(alpha|beta)[a-z0-9]*$")
Expand Down
2 changes: 2 additions & 0 deletions v2/internal/controllers/suite_test.go
Expand Up @@ -6,6 +6,7 @@ Licensed under the MIT license.
package controllers_test

import (
"flag"
"log"
"os"
"testing"
Expand All @@ -21,6 +22,7 @@ const (
)

var globalTestContext testcommon.KubeGlobalContext
var isLive = flag.Bool("live", false, "Enable to skip tests in live mode")

func setup() error {
options := getOptions()
Expand Down

0 comments on commit 5ac613d

Please sign in to comment.