diff --git a/Makefile b/Makefile index d9d0989872..6b904f0047 100644 --- a/Makefile +++ b/Makefile @@ -107,10 +107,6 @@ integration-test: azuredisk integration-test-v2: azuredisk-v2 go test -v -timeout=30m ./test/integration --temp-use-driver-v2 -.PHONY: e2e-test -e2e-test: - go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS} - .PHONY: e2e-bootstrap e2e-bootstrap: install-helm docker pull $(IMAGE_TAG) || make container-all push-manifest @@ -234,3 +230,10 @@ create-metrics-svc: delete-metrics-svc: kubectl delete -f deploy/example/metrics/csi-azuredisk-controller-svc.yaml --ignore-not-found +.PHONY: e2e-test +e2e-test: + if [ ! -z "$(EXTERNAL_E2E_TEST)" ]; then \ + bash ./test/external-e2e/run.sh;\ + else \ + go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS};\ + fi diff --git a/test/external-e2e/run.sh b/test/external-e2e/run.sh new file mode 100644 index 0000000000..f4db384cd3 --- /dev/null +++ b/test/external-e2e/run.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Copyright 2021 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Ensure that we have the desired version of the ginkgo test runner. + +PROJECT_ROOT=$(git rev-parse --show-toplevel) + +install_ginkgo () { + apt update -y + apt install -y golang-ginkgo-dev +} + +setup_e2e_binaries() { + mkdir /tmp/csi-azuredisk + + # download k8s external e2e binary for kubernetes v1.19 + curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.19.0/kubernetes-test-linux-amd64.tar.gz --output e2e-tests.tar.gz + tar -xvf e2e-tests.tar.gz && rm e2e-tests.tar.gz + + # install the azuredisk-csi-driver driver + make e2e-bootstrap +} + +install_ginkgo +setup_e2e_binaries + +ginkgo -p --progress --v -focus='External.Storage.*disk.csi.azure.com' \ + -skip='\[Disruptive\]|\[Slow\]|\[Feature:VolumeSnapshotDataSource\]' kubernetes/test/bin/e2e.test -- \ + -storage.testdriver=$PROJECT_ROOT/test/external-e2e/manifest/testdriver.yaml \ + --kubeconfig=$KUBECONFIG