Skip to content

Commit 0c89749

Browse files
committed
Add external k8s tests
1 parent b973a88 commit 0c89749

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
@@ -60,7 +60,11 @@ integration-test: blob
6060

6161
.PHONY: e2e-test
6262
e2e-test:
63-
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS}
63+
if [ ! -z "$(EXTERNAL_E2E_TEST)" ]; then \
64+
bash ./test/external-e2e/run.sh;\
65+
else \
66+
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS};\
67+
fi
6468

6569
.PHONY: e2e-bootstrap
6670
e2e-bootstrap: install-helm install-blobfuse-proxy
@@ -176,3 +180,19 @@ install-blobfuse-proxy:
176180
.PHONY: uninstall-blobfuse-proxy
177181
uninstall-blobfuse-proxy:
178182
kubectl delete -f ./deploy/blobfuse-proxy/blobfuse-proxy.yaml --ignore-not-found
183+
184+
.PHONY: setup-external-e2e
185+
setup-external-e2e:
186+
curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.19.0/kubernetes-test-linux-amd64.tar.gz --output e2e-tests.tar.gz
187+
tar -xvf e2e-tests.tar.gz
188+
rm e2e-tests.tar.gz
189+
mkdir /tmp/csi-blobfuse
190+
cp ./kubernetes/test/bin/e2e.test /tmp/csi-blobfuse/e2e.test
191+
rm -r kubernetes
192+
cp ./deploy/example/storageclass-blobfuse.yaml /tmp/csi-blobfuse/storageclass.yaml
193+
cp ./test/e2e-external/testdriver.yaml /tmp/csi-blobfuse/testdriver.yaml
194+
./deploy/install-driver.sh
195+
196+
.PHONY: run-external-e2e
197+
run-external-e2e: setup-external-e2e install-blobfuse-proxy
198+
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)