diff --git a/Makefile b/Makefile index f32a4df2da..0d8b279e0d 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 @@ -227,3 +223,22 @@ create-metrics-svc: delete-metrics-svc: kubectl delete -f deploy/example/metrics/csi-azuredisk-controller-svc.yaml --ignore-not-found +.PHONY: setup-external-e2e +setup-external-e2e: + 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 + mkdir /tmp/csi-azuredisk + cp ./kubernetes/test/bin/e2e.test /tmp/csi-azuredisk/e2e.test + rm -r kubernetes + cp ./deploy/example/storageclass-azuredisk-csi.yaml /tmp/csi-azuredisk/storageclass.yaml + cp ./test/external-e2e/manifest/testdriver.yaml /tmp/csi-azuredisk/testdriver.yaml + ./deploy/install-driver.sh + +.PHONY: e2e-test +e2e-test: setup-external-e2e + 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..ac4caa7898 --- /dev/null +++ b/test/external-e2e/run.sh @@ -0,0 +1,28 @@ +#!/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. +install_ginkgo () { + apt update -y + apt install -y golang-ginkgo-dev +} + +install_ginkgo + +ginkgo -p --progress --v -focus='External.Storage' \ + -skip='\[Disruptive\]' /tmp/csi-azuredisk/e2e.test -- \ + -storage.testdriver=/tmp/csi-azuredisk/testdriver.yaml \ + --kubeconfig=$KUBECONFIG