From e7731d6cb7a4a90e17895a061cfdba552f50deea 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 | 6 ++++-- hack/run-e2e-conformance.sh | 19 ++++--------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index f4124112bf..61c5d21685 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ MAIN_PKG=cmd/manager/main.go export NAMESPACE?=openshift-sriov-network-operator export WATCH_NAMESPACE?=openshift-sriov-network-operator export HOME?=$(PWD) +export GOPATH?=$(shell go env GOPATH) export GO111MODULE=on PKGS=$(shell go list ./... | grep -v -E '/vendor/|/test|/examples') TESTPKGS?=./... @@ -249,10 +250,11 @@ undeploy-k8s: export OPERATOR_EXEC=kubectl undeploy-k8s: undeploy deps-update: - go mod tidy + go mod tidy && \ + go mod vendor check-deps: deps-update - @set +e; git diff --quiet HEAD go.sum go.mod; \ + @set +e; git diff --quiet HEAD go.sum go.mod vendor; \ if [ $$? -eq 1 ]; \ then echo -e "\ngo modules are out of date. Please commit after running 'make deps-update' command\n"; \ exit 1; fi 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