Skip to content

Commit 25585da

Browse files
tobiasgiesezeeke
andcommitted
e2e: Install ginkgo via Makefile
Signed-off-by: Tobias Giese <[email protected]> Co-authored-by: Andrea Panattoni <[email protected]>
1 parent 00f8a61 commit 25585da

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ MAIN_PKG=cmd/manager/main.go
2828
export NAMESPACE?=openshift-sriov-network-operator
2929
export WATCH_NAMESPACE?=openshift-sriov-network-operator
3030
export HOME?=$(PWD)
31+
export GOPATH?=$(shell go env GOPATH)
3132
export GO111MODULE=on
3233
PKGS=$(shell go list ./... | grep -v -E '/vendor/|/test|/examples')
3334
TESTPKGS?=./...
@@ -162,6 +163,10 @@ GOMOCK = $(shell pwd)/bin/mockgen
162163
gomock:
163164
$(call go-install-tool,$(GOMOCK),github.com/golang/mock/[email protected])
164165

166+
GINKGO = $(BIN_DIR)/ginkgo
167+
ginkgo:
168+
$(call go-install-tool,$(GINKGO),github.com/onsi/ginkgo/v2/ginkgo)
169+
165170
# go-install-tool will 'go install' any package $2 and install it to $1.
166171
define go-install-tool
167172
@[ -f $(1) ] || { \
@@ -193,25 +198,25 @@ deploy-setup-k8s: export OPERATOR_EXEC=kubectl
193198
deploy-setup-k8s: export CLUSTER_TYPE=kubernetes
194199
deploy-setup-k8s: deploy-setup
195200

196-
test-e2e-conformance:
201+
test-e2e-conformance: ginkgo
197202
SUITE=./test/conformance ./hack/run-e2e-conformance.sh
198203

199-
test-e2e-conformance-virtual-k8s-cluster-ci:
204+
test-e2e-conformance-virtual-k8s-cluster-ci: ginkgo
200205
./hack/run-e2e-conformance-virtual-cluster.sh
201206

202-
test-e2e-conformance-virtual-k8s-cluster:
207+
test-e2e-conformance-virtual-k8s-cluster: ginkgo
203208
SKIP_DELETE=TRUE ./hack/run-e2e-conformance-virtual-cluster.sh
204209

205-
test-e2e-conformance-virtual-ocp-cluster-ci:
210+
test-e2e-conformance-virtual-ocp-cluster-ci: ginkgo
206211
./hack/run-e2e-conformance-virtual-ocp.sh
207212

208-
test-e2e-conformance-virtual-ocp-cluster:
213+
test-e2e-conformance-virtual-ocp-cluster: ginkgo
209214
SKIP_DELETE=TRUE ./hack/run-e2e-conformance-virtual-ocp.sh
210215

211216
redeploy-operator-virtual-cluster:
212217
./hack/virtual-cluster-redeploy.sh
213218

214-
test-e2e-validation-only:
219+
test-e2e-validation-only: ginkgo
215220
SUITE=./test/validation ./hack/run-e2e-conformance.sh
216221

217222
test-e2e: generate manifests skopeo envtest

hack/run-e2e-conformance.sh

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
#!/bin/bash
2-
set -x
3-
which ginkgo
4-
if [ $? -ne 0 ]; then
5-
# we are moving to a temp folder as in go.mod we have a dependency that is not
6-
# resolved if we are not using google's GOPROXY. That is not the case when building as
7-
# we are using vendored dependencies
8-
GINKGO_TMP_DIR=$(mktemp -d)
9-
cd $GINKGO_TMP_DIR
10-
go mod init tmp
11-
go install -mod=readonly github.com/onsi/ginkgo/v2/[email protected]
12-
rm -rf $GINKGO_TMP_DIR
13-
echo "Downloading ginkgo tool"
14-
cd -
15-
fi
162

17-
GOPATH="${GOPATH:-~/go}"
3+
here="$(dirname "$(readlink --canonicalize "${BASH_SOURCE[0]}")")"
4+
root="$(readlink --canonicalize "$here/..")"
5+
6+
GOPATH="${GOPATH:-$HOME/go}"
187
JUNIT_OUTPUT="${JUNIT_OUTPUT:-/tmp/artifacts}"
198
export PATH=$PATH:$GOPATH/bin
209

21-
ginkgo -output-dir=$JUNIT_OUTPUT --junit-report "unit_report.xml" -v "$SUITE" -- -report=$JUNIT_OUTPUT
10+
${root}/bin/ginkgo -output-dir=$JUNIT_OUTPUT --junit-report "unit_report.xml" -v "$SUITE" -- -report=$JUNIT_OUTPUT

0 commit comments

Comments
 (0)