ci: add "make run-e2e"

The keeps the standard arguments for e2e testing in a single location
instead of spread over multiple files and CI jobs.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-07-30 15:48:42 +02:00 committed by mergify[bot]
parent ff94ba282c
commit 74ba85f87b
3 changed files with 18 additions and 2 deletions

View File

@ -130,6 +130,22 @@ cephcsi: check-env
e2e.test: check-env e2e.test: check-env
go test $(GO_TAGS) -mod=vendor -c ./e2e go test $(GO_TAGS) -mod=vendor -c ./e2e
#
# e2e testing by compiling e2e.test in case it does not exist and running the
# executable. The e2e.test executable is not checked as a dependency in the
# make rule, as the phony check-env causes rebuilds for each run.
#
# Usage: make run-e2e E2E_ARGS="--test-cephfs=false --test-rbd=true"
#
.PHONY: run-e2e
run-e2e: E2E_TIMEOUT ?= $(shell . $(CURDIR)/build.env ; echo $${E2E_TIMEOUT})
run-e2e: DEPLOY_TIMEOUT ?= $(shell . $(CURDIR)/build.env ; echo $${DEPLOY_TIMEOUT})
run-e2e: NAMESPACE ?= cephcsi-e2e-$(shell uuidgen | cut -d- -f1)
run-e2e:
@test -e e2e.test || $(MAKE) e2e.test
cd e2e && \
../e2e.test -test.v -test.timeout="${E2E_TIMEOUT}" --deploy-timeout="${DEPLOY_TIMEOUT}" --cephcsi-namespace=$(NAMESPACE) $(E2E_ARGS)
need-container-cmd: need-container-cmd:
@test -n "$(shell which $(CONTAINER_CMD) 2>/dev/null)" || { echo "Missing container support, install Podman or Docker"; exit 1; } @test -n "$(shell which $(CONTAINER_CMD) 2>/dev/null)" || { echo "Missing container support, install Podman or Docker"; exit 1; }

View File

@ -39,7 +39,7 @@ if [[ "${KUBE_MAJOR}" -ge 1 ]] && [[ "${KUBE_MINOR}" -ge 17 ]]; then
fi fi
# functional tests # functional tests
go test "${GO_TAGS}" github.com/ceph/ceph-csi/e2e --deploy-timeout="${DEPLOY_TIMEOUT}" -timeout="${E2E_TIMEOUT}" --cephcsi-namespace=cephcsi-e2e-$RANDOM -v -mod=vendor "${@}" make run-e2e E2E_ARGS="${*}"
if [[ "${KUBE_MAJOR}" -ge 1 ]] && [[ "${KUBE_MINOR}" -ge 17 ]]; then if [[ "${KUBE_MAJOR}" -ge 1 ]] && [[ "${KUBE_MINOR}" -ge 17 ]]; then
# delete snapshot CRD # delete snapshot CRD

View File

@ -50,7 +50,7 @@ scripts/install-helm.sh up
# install cephcsi helm charts # install cephcsi helm charts
scripts/install-helm.sh install-cephcsi ${NAMESPACE} scripts/install-helm.sh install-cephcsi ${NAMESPACE}
# functional tests # functional tests
go test "${GO_TAGS}" github.com/ceph/ceph-csi/e2e -mod=vendor --deploy-timeout="${DEPLOY_TIMEOUT}" -timeout="${E2E_TIMEOUT}" --cephcsi-namespace=${NAMESPACE} --deploy-cephfs=false --deploy-rbd=false -v "${@}" make run-e2e NAMESPACE="${NAMESPACE}" E2E_ARGS="--deploy-cephfs=false --deploy-rbd=false ${*}"
#cleanup #cleanup
# skip snapshot operation if kube version is less than 1.17.0 # skip snapshot operation if kube version is less than 1.17.0