Skip to content

Commit 03dbab4

Browse files
committed
improve(ws): add controller-image parameter to e2e tests
Signed-off-by: Edson Tirelli <[email protected]>
1 parent b981275 commit 03dbab4

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

workspaces/controller/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Image URL to use all building/pushing image targets
22
IMG ?= controller:latest
3+
34
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
45
ENVTEST_K8S_VERSION = 1.31.0
56

@@ -77,7 +78,7 @@ test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated
7778
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
7879
exit 1; \
7980
}
80-
go test ./test/e2e/ -v -ginkgo.v
81+
go test ./test/e2e/ -v -ginkgo.v -args -controller-image=${IMG}
8182

8283
.PHONY: lint
8384
lint: golangci-lint ## Run golangci-lint linter

workspaces/controller/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ kubectl apply -k config/samples/
4949

5050
>**NOTE**: Ensure that the samples has default values to test it out.
5151
52+
**Run the e2e tests**
53+
54+
```sh
55+
make test-e2e
56+
```
57+
58+
If you would like to run the tests with a given image, use the IMG parameter:
59+
60+
```sh
61+
make test-e2e IMG=<some-registry>/workspace-controller:tag
62+
```
63+
5264
### To Uninstall
5365
**Delete the instances (CRs) from the cluster:**
5466

workspaces/controller/test/e2e/e2e_test.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package e2e
1818

1919
import (
20+
"flag"
2021
"fmt"
2122
"os/exec"
2223
"path/filepath"
@@ -34,8 +35,8 @@ import (
3435

3536
const (
3637
// controller configs
37-
controllerNamespace = "workspace-controller-system"
38-
controllerImage = "ghcr.io/kubeflow/notebooks/workspace-controller:latest"
38+
controllerNamespace = "workspace-controller-system"
39+
defaultControllerImage = "ghcr.io/kubeflow/notebooks/workspace-controller:latest"
3940

4041
// workspace configs
4142
workspaceNamespace = "workspace-test"
@@ -60,13 +61,23 @@ const (
6061
)
6162

6263
var (
63-
projectDir = ""
64+
projectDir = ""
65+
controllerImage = ""
6466
)
6567

68+
func init() {
69+
flag.StringVar(&controllerImage, "controller-image",
70+
defaultControllerImage, "Workspace controller image to use for the test")
71+
}
72+
6673
var _ = Describe("controller", Ordered, func() {
6774

6875
BeforeAll(func() {
6976
projectDir, _ = utils.GetProjectDir()
77+
// This ensures flags are parsed before tests run
78+
if !flag.Parsed() {
79+
flag.Parse()
80+
}
7081

7182
By("creating the controller namespace")
7283
cmd := exec.Command("kubectl", "create", "ns", controllerNamespace)

0 commit comments

Comments
 (0)