From 1dd9ce4c7275609003ccb38ac9763ca79745718e Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Wed, 20 Nov 2024 01:14:13 -0500 Subject: [PATCH] tests: set the OPERATOR_NAMESPACE in the test suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows one to run the a specific test using the ginkgo cli or by using the vscode test decorators. For example: ``` $ ginkgo -focus "ClientProfile Controller" -r [1732083376] Controller Suite - 1/3 specs SS• SUCCESS! 5.797831s PASS Starting ceph-csi-operator suite [1732083376] e2e suite - 0/1 specs S SUCCESS! 59.25µs PASS Ginkgo ran 2 suites in 10.605577042s Test Suite Passed ``` Signed-off-by: Raghavendra Talur --- internal/controller/suite_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/controller/suite_test.go b/internal/controller/suite_test.go index 7cd1ef8f..0d2ef345 100644 --- a/internal/controller/suite_test.go +++ b/internal/controller/suite_test.go @@ -18,6 +18,7 @@ package controller import ( "fmt" + "os" "path/filepath" "runtime" "testing" @@ -66,6 +67,11 @@ var _ = BeforeSuite(func() { fmt.Sprintf("1.29.0-%s-%s", runtime.GOOS, runtime.GOARCH)), } + _, set := os.LookupEnv("OPERATOR_NAMESPACE") + if !set { + Expect(os.Setenv("OPERATOR_NAMESPACE", "ceph-csi-operator-system")).To(Succeed()) + } + var err error // cfg is defined in this file globally. cfg, err = testEnv.Start()