Skip to content

Commit 6ba0258

Browse files
authored
Merge pull request #254 from boddumanohar/external-e2e-tests
Add K8s external storage E2E tests
2 parents d91bc8b + 855e206 commit 6ba0258

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ deploy-kind:
8585

8686
.PHONY: e2e-test
8787
e2e-test:
88-
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS}
88+
if [ ! -z "$(EXTERNAL_E2E_TEST)" ]; then \
89+
bash ./test/external-e2e/run.sh;\
90+
else \
91+
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS};\
92+
fi
8993

9094
.PHONY: e2e-bootstrap
9195
e2e-bootstrap: install-helm

test/external-e2e/run.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# Copyright 2021 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -xe
18+
19+
PROJECT_ROOT=$(git rev-parse --show-toplevel)
20+
21+
install_ginkgo () {
22+
apt update -y
23+
apt install -y golang-ginkgo-dev
24+
}
25+
26+
setup_e2e_binaries() {
27+
# download k8s external e2e binary for kubernetes v1.19
28+
curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.19.0/kubernetes-test-linux-amd64.tar.gz --output e2e-tests.tar.gz
29+
tar -xvf e2e-tests.tar.gz && rm e2e-tests.tar.gz
30+
31+
# install the csi driver smb
32+
mkdir -p /tmp/csi-smb && cp deploy/example/storageclass-smb.yaml /tmp/csi-smb/storageclass.yaml
33+
make e2e-bootstrap
34+
make install-smb-provisioner
35+
make create-metrics-svc
36+
}
37+
38+
print_logs() {
39+
echo "print out driver logs ..."
40+
bash ./test/utils/smb_log.sh
41+
}
42+
43+
install_ginkgo
44+
setup_e2e_binaries
45+
trap print_logs EXIT
46+
47+
ginkgo -p --progress --v -focus='External.Storage' \
48+
-skip='\[Disruptive\]|\[Slow\]' kubernetes/test/bin/e2e.test -- \
49+
-storage.testdriver=$PROJECT_ROOT/test/external-e2e/testdriver.yaml \
50+
--kubeconfig=$KUBECONFIG

test/external-e2e/testdriver.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Manifest for Kubernetes external tests.
2+
# See https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external
3+
4+
ShortName: smb
5+
StorageClass:
6+
FromFile: /tmp/csi-smb/storageclass.yaml
7+
DriverInfo:
8+
Name: smb.csi.k8s.io
9+
Capabilities:
10+
persistence: true
11+
exec: true
12+
multipods: true
13+
RWX: true

0 commit comments

Comments
 (0)