From 077b50c4920dbc9d6ce189e76e9209c479055cc2 Mon Sep 17 00:00:00 2001 From: Tobias Giese Date: Thu, 18 Jul 2024 17:38:21 +0200 Subject: [PATCH] e2e: Install ginkgo via Makefile Signed-off-by: Tobias Giese Co-authored-by: Andrea Panattoni --- Makefile | 16 ++++++++++------ hack/run-e2e-conformance.sh | 19 ++++--------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index f4124112bf..816fb048d3 100644 --- a/Makefile +++ b/Makefile @@ -162,6 +162,10 @@ GOMOCK = $(shell pwd)/bin/mockgen gomock: $(call go-install-tool,$(GOMOCK),github.com/golang/mock/mockgen@v1.6.0) +GINKGO = $(BIN_DIR)/ginkgo +ginkgo: + $(call go-install-tool,$(GINKGO),github.com/onsi/ginkgo/v2/ginkgo) + # go-install-tool will 'go install' any package $2 and install it to $1. define go-install-tool @[ -f $(1) ] || { \ @@ -193,25 +197,25 @@ deploy-setup-k8s: export OPERATOR_EXEC=kubectl deploy-setup-k8s: export CLUSTER_TYPE=kubernetes deploy-setup-k8s: deploy-setup -test-e2e-conformance: +test-e2e-conformance: ginkgo SUITE=./test/conformance ./hack/run-e2e-conformance.sh -test-e2e-conformance-virtual-k8s-cluster-ci: +test-e2e-conformance-virtual-k8s-cluster-ci: ginkgo ./hack/run-e2e-conformance-virtual-cluster.sh -test-e2e-conformance-virtual-k8s-cluster: +test-e2e-conformance-virtual-k8s-cluster: ginkgo SKIP_DELETE=TRUE ./hack/run-e2e-conformance-virtual-cluster.sh -test-e2e-conformance-virtual-ocp-cluster-ci: +test-e2e-conformance-virtual-ocp-cluster-ci: ginkgo ./hack/run-e2e-conformance-virtual-ocp.sh -test-e2e-conformance-virtual-ocp-cluster: +test-e2e-conformance-virtual-ocp-cluster: ginkgo SKIP_DELETE=TRUE ./hack/run-e2e-conformance-virtual-ocp.sh redeploy-operator-virtual-cluster: ./hack/virtual-cluster-redeploy.sh -test-e2e-validation-only: +test-e2e-validation-only: ginkgo SUITE=./test/validation ./hack/run-e2e-conformance.sh test-e2e: generate manifests skopeo envtest diff --git a/hack/run-e2e-conformance.sh b/hack/run-e2e-conformance.sh index 123bbfd96b..8a04b8c5e0 100755 --- a/hack/run-e2e-conformance.sh +++ b/hack/run-e2e-conformance.sh @@ -1,21 +1,10 @@ #!/bin/bash -set -x -which ginkgo -if [ $? -ne 0 ]; then -# we are moving to a temp folder as in go.mod we have a dependency that is not -# resolved if we are not using google's GOPROXY. That is not the case when building as -# we are using vendored dependencies - GINKGO_TMP_DIR=$(mktemp -d) - cd $GINKGO_TMP_DIR - go mod init tmp - go install -mod=readonly github.com/onsi/ginkgo/v2/ginkgo@v2.9.5 - rm -rf $GINKGO_TMP_DIR - echo "Downloading ginkgo tool" - cd - -fi + +here="$(dirname "$(readlink --canonicalize "${BASH_SOURCE[0]}")")" +root="$(readlink --canonicalize "$here/..")" GOPATH="${GOPATH:-~/go}" JUNIT_OUTPUT="${JUNIT_OUTPUT:-/tmp/artifacts}" export PATH=$PATH:$GOPATH/bin -ginkgo -output-dir=$JUNIT_OUTPUT --junit-report "unit_report.xml" -v "$SUITE" -- -report=$JUNIT_OUTPUT +${root}/bin/ginkgo -output-dir=$JUNIT_OUTPUT --junit-report "unit_report.xml" -v "$SUITE" -- -report=$JUNIT_OUTPUT