Skip to content

Commit

Permalink
tests: set the OPERATOR_NAMESPACE in the test suite
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
raghavendra-talur committed Nov 20, 2024
1 parent 4257b04 commit 1dd9ce4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/controller/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package controller

import (
"fmt"
"os"
"path/filepath"
"runtime"
"testing"
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1dd9ce4

Please sign in to comment.