diff --git a/Makefile b/Makefile index c01f49e2f..93fe34fb1 100644 --- a/Makefile +++ b/Makefile @@ -124,4 +124,21 @@ e2e-teardown: .PHONY: e2e-test e2e-test: - go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS} \ No newline at end of file + go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS} + +.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-nfs + cp ./kubernetes/test/bin/e2e.test /tmp/csi-nfs/e2e.test + rm -r kubernetes + cp ./examples/kubernetes/storageclass-nfs.yaml /tmp/csi-nfs/storageclass.yaml + cp ./test/e2e-external/testdriver.yaml /tmp/csi-nfs/testdriver.yaml + ./deploy/install-driver.sh + kubectl apply -f deploy/example/nfs-provisioner/nfs-server.yaml + +.PHONY: run-external-e2e +run-external-e2e: setup-external-e2e + bash ./test/e2e-external/run.sh diff --git a/test/e2e-external/README.md b/test/e2e-external/README.md new file mode 100644 index 000000000..accf08b98 --- /dev/null +++ b/test/e2e-external/README.md @@ -0,0 +1,19 @@ +@@ +# Kubernetes tests + +This directory imports tests from kubernetes/kubernetes and enables: + +* External CSI tests, https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external + +# Prerequisites +- kubernetes 1.17+ + +# Run +* External CSI tests: `FOCUS=External.Storage`. + +```sh +ginkgo -p --progress --v -focus='External.Storage' \ + -skip='\[Disruptive\]' /tmp/csi-nfs/e2e.test -- \ + -storage.testdriver=/tmp/csi-nfs/testdriver.yaml \ + --kubeconfig=$KUBECONFIG +``` diff --git a/test/e2e-external/run.sh b/test/e2e-external/run.sh new file mode 100644 index 000000000..04a0db0d7 --- /dev/null +++ b/test/e2e-external/run.sh @@ -0,0 +1,19 @@ +# Copyright 2020 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. + +#!/bin/bash +ginkgo -p --progress --v -focus='External.Storage' \ + -skip='\[Disruptive\]' /tmp/csi-nfs/e2e.test -- \ + -storage.testdriver=/tmp/csi-nfs/testdriver.yaml \ + --kubeconfig=$KUBECONFIG diff --git a/test/e2e-external/testdriver.yaml b/test/e2e-external/testdriver.yaml new file mode 100644 index 000000000..c936d9878 --- /dev/null +++ b/test/e2e-external/testdriver.yaml @@ -0,0 +1,13 @@ +# Manifest for Kubernetes external tests. +# See https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external + +ShortName: nfs +StorageClass: + FromFile: /tmp/csi-nfs/storageclass.yaml +DriverInfo: + Name: nfs.csi.k8s.io + Capabilities: + persistence: true + exec: true + multipods: true + RWX: true