Skip to content

Commit 8839f5b

Browse files
authored
Merge pull request #395 from boddumanohar/external-e2e-tests
Add external k8s e2e tests
2 parents 87b6791 + 0c89749 commit 8839f5b

File tree

3 files changed

+83
-1
lines changed

3 files changed

+83
-1
lines changed

Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ integration-test: blob
6666

6767
.PHONY: e2e-test
6868
e2e-test:
69-
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS}
69+
if [ ! -z "$(EXTERNAL_E2E_TEST)" ]; then \
70+
bash ./test/external-e2e/run.sh;\
71+
else \
72+
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS};\
73+
fi
7074

7175
.PHONY: e2e-bootstrap
7276
e2e-bootstrap: install-helm
@@ -177,3 +181,19 @@ install-blobfuse-proxy:
177181
.PHONY: uninstall-blobfuse-proxy
178182
uninstall-blobfuse-proxy:
179183
kubectl delete -f ./deploy/blobfuse-proxy/blobfuse-proxy.yaml --ignore-not-found
184+
185+
.PHONY: setup-external-e2e
186+
setup-external-e2e:
187+
curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.19.0/kubernetes-test-linux-amd64.tar.gz --output e2e-tests.tar.gz
188+
tar -xvf e2e-tests.tar.gz
189+
rm e2e-tests.tar.gz
190+
mkdir /tmp/csi-blobfuse
191+
cp ./kubernetes/test/bin/e2e.test /tmp/csi-blobfuse/e2e.test
192+
rm -r kubernetes
193+
cp ./deploy/example/storageclass-blobfuse.yaml /tmp/csi-blobfuse/storageclass.yaml
194+
cp ./test/e2e-external/testdriver.yaml /tmp/csi-blobfuse/testdriver.yaml
195+
./deploy/install-driver.sh
196+
197+
.PHONY: run-external-e2e
198+
run-external-e2e: setup-external-e2e install-blobfuse-proxy
199+
bash ./test/e2e-external/run.sh

test/external-e2e/run.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 blob csi driver
32+
mkdir -p /tmp/csi-blob && cp deploy/example/storageclass-blobfuse.yaml /tmp/csi-blob/storageclass.yaml
33+
make e2e-bootstrap
34+
make create-metrics-svc
35+
}
36+
37+
print_logs() {
38+
echo "print out driver logs ..."
39+
bash ./test/utils/blob_log.sh
40+
}
41+
42+
install_ginkgo
43+
setup_e2e_binaries
44+
trap print_logs EXIT
45+
46+
ginkgo -p --progress --v -focus='External.Storage.*blob.csi.azure.com' \
47+
-skip='\[Disruptive\]|\[Slow\]' kubernetes/test/bin/e2e.test -- \
48+
-storage.testdriver=$PROJECT_ROOT/test/external-e2e/testdriver.yaml \
49+
--kubeconfig=$KUBECONFIG

test/external-e2e/testdriver.yaml

Lines changed: 13 additions & 0 deletions
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: blobfuse
5+
StorageClass:
6+
FromFile: /tmp/csi-blob/storageclass.yaml
7+
DriverInfo:
8+
Name: blob.csi.azure.com
9+
Capabilities:
10+
persistence: true
11+
exec: true
12+
multipods: true
13+
RWX: true

0 commit comments

Comments
 (0)