From a4bdb56536482dc5649ca931e86772054f7b74d5 Mon Sep 17 00:00:00 2001 From: Humair Khan Date: Thu, 19 Oct 2023 17:36:23 -0400 Subject: [PATCH] Add make command for integration tests. Signed-off-by: Humair Khan --- .github/workflows/kind-integration.yml | 2 +- Makefile | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/kind-integration.yml b/.github/workflows/kind-integration.yml index d5adac01f..2b9b097bb 100644 --- a/.github/workflows/kind-integration.yml +++ b/.github/workflows/kind-integration.yml @@ -83,7 +83,7 @@ jobs: NAMESPACE: ${{ env.DSPA_NAMESPACE }} DSPA_NAME: ${{ env.DSPA_NAME }} run: | - go run github.com/onsi/ginkgo/v2/ginkgo --tags=test_integration -- -kubeconfig=$HOME/.kube/config -k8sApiServerHost=$(oc whoami --show-server) -DSPANamespace=${{ env.DSPA_NAMESPACE }} -DSPAPath=resources/dspa-lite.yaml -ginkgo.v + make integrationtest K8SAPISERVERHOST=$(oc whoami --show-server) DSPANAMESPACE=dspa - name: Clean up run: | diff --git a/Makefile b/Makefile index c1ea49cb4..6089ec6e9 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,12 @@ ENVTEST_K8S_VERSION = 1.25.0 # Namespace to deploy the operator OPERATOR_NS ?= odh-applications +# Integration Test ENVvars +KUBECONFIGPATH ?= $(HOME)/.kube/config +K8SAPISERVERHOST ?= http://localhost:6443 +DSPANAMESPACE ?= default +DSPAPATH ?= resources/dspa-lite.yaml + # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin @@ -115,6 +121,11 @@ unittest: manifests generate fmt vet envtest ## Run tests. functest: manifests generate fmt vet envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... --tags=test_functional -coverprofile cover.out +.PHONY: integrationtest +integrationtest: ## Run integration tests + cd tests && \ + go run github.com/onsi/ginkgo/v2/ginkgo --tags=test_integration -- -kubeconfig=${KUBECONFIGPATH} -k8sApiServerHost=${K8SAPISERVERHOST} -DSPANamespace=${DSPANAMESPACE} -DSPAPath=${DSPAPATH} -ginkgo.v + ##@ Build .PHONY: build