Skip to content

Commit

Permalink
Run controller tests with test-unit make target
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianZaccaria committed May 21, 2024
1 parent 2d00f45 commit 21ef9ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ catalog-push: ## Push a catalog image.

.PHONY: test-unit
test-unit: manifests fmt vet envtest ## Run unit tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(go list ./... | grep -v /test/) -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v ./pkg/controllers/ -coverprofile cover.out

.PHONY: test-component
test-component: envtest ginkgo ## Run component tests.
Expand Down
3 changes: 1 addition & 2 deletions pkg/controllers/raycluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,10 @@ func TestValidateCreate(t *testing.T) {
})

// Negative Test: Invalid RayCluster with EnableIngress set to true
trueBool := true
invalidRayCluster := validRayCluster.DeepCopy()

t.Run("Negative: Expected errors on call to ValidateCreate function due to EnableIngress set to True", func(t *testing.T) {
invalidRayCluster.Spec.HeadGroupSpec.EnableIngress = &trueBool
invalidRayCluster.Spec.HeadGroupSpec.EnableIngress = support.Ptr(true)
_, err := rcWebhook.ValidateCreate(test.Ctx(), runtime.Object(invalidRayCluster))
test.Expect(err).Should(HaveOccurred(), "Expected errors on call to ValidateCreate function due to EnableIngress set to True")
})
Expand Down

0 comments on commit 21ef9ac

Please sign in to comment.