From a0fc119bbe5ba3cdd37a1ff10687ae80c489901c Mon Sep 17 00:00:00 2001 From: anandrkskd Date: Mon, 20 Jun 2022 13:39:53 +0530 Subject: [PATCH] use ginkgo binary for tests Signed-off-by: anandrkskd --- .ibm/pipelines/kubernetes-tests.sh | 1 + .ibm/pipelines/openshift-tests.sh | 1 + Makefile | 9 ++++----- scripts/openshiftci-periodic-tests.sh | 1 + scripts/openshiftci-presubmit-all-tests.sh | 1 + scripts/tools.go | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.ibm/pipelines/kubernetes-tests.sh b/.ibm/pipelines/kubernetes-tests.sh index 02ac58c8e3b..c762fc008dd 100755 --- a/.ibm/pipelines/kubernetes-tests.sh +++ b/.ibm/pipelines/kubernetes-tests.sh @@ -12,6 +12,7 @@ cleanup_namespaces ( set -e + make goget-ginkgo make install make test-integration-devfile make test-interactive diff --git a/.ibm/pipelines/openshift-tests.sh b/.ibm/pipelines/openshift-tests.sh index 76afc0fc398..bd0d44f09b0 100755 --- a/.ibm/pipelines/openshift-tests.sh +++ b/.ibm/pipelines/openshift-tests.sh @@ -13,6 +13,7 @@ cleanup_namespaces ( set -e + make goget-ginkgo make install make test-integration make test-interactive diff --git a/Makefile b/Makefile index a8b8f33670e..c9b48146e33 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ else endif # Slow spec threshold for ginkgo tests. After this time (in second), ginkgo marks test as slow -SLOW_SPEC_THRESHOLD := 120 +SLOW_SPEC_THRESHOLD := 120s # Env variable GINKGO_TEST_ARGS is used to get control over enabling ginkgo test flags against each test target run. # For example: @@ -45,7 +45,7 @@ export ODO_LOG_LEVEL ?= 4 # To enable verbosity export or set env GINKGO_TEST_ARGS like "GINKGO_TEST_ARGS=-v" UNIT_TEST_ARGS ?= -GINKGO_FLAGS_ALL = $(GINKGO_TEST_ARGS) -randomizeAllSpecs -slowSpecThreshold=$(SLOW_SPEC_THRESHOLD) -timeout $(TIMEOUT) +GINKGO_FLAGS_ALL = $(GINKGO_TEST_ARGS) --randomize-all -slow-spec-threshold=$(SLOW_SPEC_THRESHOLD) -timeout $(TIMEOUT) # Flags for tests that must not be run in parallel. GINKGO_FLAGS_SERIAL = $(GINKGO_FLAGS_ALL) -nodes=1 @@ -53,7 +53,7 @@ GINKGO_FLAGS_SERIAL = $(GINKGO_FLAGS_ALL) -nodes=1 GINKGO_FLAGS=$(GINKGO_FLAGS_ALL) -nodes=$(TEST_EXEC_NODES) -RUN_GINKGO = GOFLAGS='-mod=vendor' go run $(COMMON_GOFLAGS) github.com/onsi/ginkgo/ginkgo +RUN_GINKGO = ginkgo default: bin @@ -116,8 +116,7 @@ goget-tools: .PHONY: goget-ginkgo goget-ginkgo: - @echo "This is no longer used." - @echo "Ginkgo can be executed directly from this repository using command '$(RUN_GINKGO)'" + go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo@latest .PHONY: test-coverage test-coverage: ## Run unit tests and collect coverage diff --git a/scripts/openshiftci-periodic-tests.sh b/scripts/openshiftci-periodic-tests.sh index d4be0bd2e71..2d56e05a1fd 100755 --- a/scripts/openshiftci-periodic-tests.sh +++ b/scripts/openshiftci-periodic-tests.sh @@ -27,6 +27,7 @@ oc login -u developer -p password@123 oc whoami # Integration tests +make goget-ginkgo || error=true make test-integration || error=true make test-integration-devfile || error=true make test-cmd-login-logout || error=true diff --git a/scripts/openshiftci-presubmit-all-tests.sh b/scripts/openshiftci-presubmit-all-tests.sh index 4bc0969f10d..0a3e78b18c9 100755 --- a/scripts/openshiftci-presubmit-all-tests.sh +++ b/scripts/openshiftci-presubmit-all-tests.sh @@ -15,6 +15,7 @@ else make configure-installer-tests-cluster fi make bin +make goget-ginkgo mkdir -p $GOPATH/bin make goget-ginkgo export PATH="$PATH:$(pwd):$GOPATH/bin" diff --git a/scripts/tools.go b/scripts/tools.go index cd1c1459b6f..079f082b6c3 100644 --- a/scripts/tools.go +++ b/scripts/tools.go @@ -5,7 +5,7 @@ package tools import ( _ "github.com/frapposelli/wwhrd" - _ "github.com/onsi/ginkgo/ginkgo" + _ "github.com/onsi/ginkgo/v2" _ "github.com/securego/gosec/v2/cmd/gosec" )