Skip to content

Commit 3639b59

Browse files
committed
test: skip e2e tests when TEST_E2E is not set
The `test/cvo` e2e tests require a live OpenShift cluster but ran unconditionally during `make test`, causing failures when no cluster is available. This commit adds a `TEST_E2E` env var guard to TestGinkgo Signed-off-by: vprashar2929 <vibhu.sharma2929@gmail.com>
1 parent f763687 commit 3639b59

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ make test # Runs gotestsum with JUnit XML output to _output/junit.
3333
# Single package test
3434
gotestsum --packages="./pkg/cvo"
3535

36+
# E2E tests (requires KUBECONFIG with admin credentials for a disposable cluster)
37+
TEST_E2E=1 go test ./test/cvo/
38+
3639
# Integration tests (requires KUBECONFIG with admin credentials for a disposable cluster)
3740
make integration-test # Runs tests with TEST_INTEGRATION=1 against real cluster
3841

docs/dev/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ $ oc adm release new --from-release=quay.io/openshift-release-dev/ocp-release:4.
114114

115115
Run `make test` to execute all unit tests.
116116

117+
### E2E tests
118+
119+
Run `TEST_E2E=1 go test ./test/cvo/` to execute E2E tests against an OpenShift cluster. It requires `$KUBECONFIG` with
120+
administrator credentials. Only execute E2E tests against disposable testing clusters.
121+
117122
### Integration tests
118123

119124
Run `make integration-test` to execute integration tests against an OpenShift cluster. It requires `$KUBECONFIG` with

test/cvo/cvo_suite_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
package cvo
44

55
import (
6+
"os"
67
"testing"
78

89
. "github.com/onsi/ginkgo/v2"
910
. "github.com/onsi/gomega"
1011
)
1112

1213
func TestGinkgo(t *testing.T) {
14+
if os.Getenv("TEST_E2E") != "1" {
15+
t.Skipf("E2E tests are disabled unless TEST_E2E=1")
16+
}
1317
RegisterFailHandler(Fail)
1418
RunSpecs(t, "CVO Suite")
1519
}

0 commit comments

Comments
 (0)