Skip to content

Commit 514f978

Browse files
committed
setup e2e tests in github actions
1 parent ee54478 commit 514f978

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

.github/workflows/ubuntu-e2e.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Ubuntu E2E tests
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master ]
7+
8+
jobs:
9+
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Set up Go 1.x
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: ^1.13
19+
id: go
20+
21+
- name: Check out code into the Go module directory
22+
uses: actions/checkout@v2
23+
24+
- name: e2e tests
25+
run: |
26+
make deploy-kind
27+
make
28+
make e2e-test

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ sanity-test: smb
6161
integration-test: smb
6262
sudo -E env "PATH=$$PATH" bash test/integration/run-test.sh
6363

64+
.PHONY: deploy-kind
65+
deploy-kind:
66+
test/utils/deploy-kind.sh
67+
6468
.PHONY: e2e-test
6569
e2e-test:
6670
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS}

test/utils/deploy-kind.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2020 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
#!/bin/bash
16+
17+
KUBERNETES_VERSION=v1.18.8
18+
KUBECONFIG=$HOME/.kube/config
19+
20+
# Setup and download kind
21+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64 && chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind
22+
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$KUBERNETES_VERSION/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
23+
24+
sudo kind create cluster --image kindest/node:$KUBERNETES_VERSION
25+
mkdir -p $HOME/.kube
26+
sudo chown -R $USER: $HOME/.kube/
27+
sudo kind get kubeconfig > $KUBECONFIG
28+
29+
echo "Setup samba server and deploy SMB CSI driver"
30+
kubectl cluster-info
31+
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n kube-system get pods -lk8s-app=kube-dns -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1;echo "waiting for kube-dns to be available"; done
32+
kubectl create secret generic smbcreds --from-literal username=USERNAME --from-literal password="PASSWORD"
33+
kubectl create -f deploy/example/smb-provisioner/smb-server.yaml
34+
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n default get pods -lapp=smb-server -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1;echo "waiting for smb controller deployment to be available"; done
35+
bash deploy/install-driver.sh
36+
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n kube-system get pods -lapp=csi-smb-controller -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1;echo "waiting for smb controller deployment to be available"; done
37+
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n kube-system get pods -lapp=csi-smb-node -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1;echo "waiting for smb node deployment to be available"; done
38+
echo "CSI Driver is installed"

0 commit comments

Comments
 (0)