Skip to content

Commit

Permalink
setup k8s external e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boddumanohar committed Apr 28, 2021
1 parent ad09cc2 commit bb87668
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
43 changes: 43 additions & 0 deletions test/external-e2e/run.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bb87668

Please sign in to comment.