Skip to content

improve(ws): add controller-image parameter to e2e tests #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: notebooks-v2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion workspaces/controller/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not sure if I should change the default here to ghcr.io/kubeflow/notebooks/workspace-controller:latest to stay consistent with the previous e2e test behaviour or even create a separate parameter for it. Let me know please if you prefer that I do that.


# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.31.0

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

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
12 changes: 12 additions & 0 deletions workspaces/controller/README.md
Original file line number Diff line number Diff line change
@@ -49,6 +49,18 @@ kubectl apply -k config/samples/

>**NOTE**: Ensure that the samples has default values to test it out.

**Run the e2e tests**

```sh
make test-e2e
```

If you would like to run the tests with a given image, use the IMG parameter:

```sh
make test-e2e IMG=<some-registry>/workspace-controller:tag
```

### To Uninstall
**Delete the instances (CRs) from the cluster:**

17 changes: 14 additions & 3 deletions workspaces/controller/test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ limitations under the License.
package e2e

import (
"flag"
"fmt"
"os/exec"
"path/filepath"
@@ -34,8 +35,8 @@ import (

const (
// controller configs
controllerNamespace = "workspace-controller-system"
controllerImage = "ghcr.io/kubeflow/notebooks/workspace-controller:latest"
controllerNamespace = "workspace-controller-system"
defaultControllerImage = "ghcr.io/kubeflow/notebooks/workspace-controller:latest"

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

var (
projectDir = ""
projectDir = ""
controllerImage = ""
)

func init() {
flag.StringVar(&controllerImage, "controller-image",
defaultControllerImage, "Workspace controller image to use for the test")
}

var _ = Describe("controller", Ordered, func() {

BeforeAll(func() {
projectDir, _ = utils.GetProjectDir()
// This ensures flags are parsed before tests run
if !flag.Parsed() {
flag.Parse()
}

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