Skip to content

Setup e2e tests as a part of PR workflow #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

CMDS=nfsplugin
CMDS=nfsplugin tests
all: build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it. I meant to add an extra command: tests


include release-tools/build.make
Expand All @@ -21,3 +21,10 @@ include release-tools/build.make
sanity-test: build
./test/sanity/run-test.sh

.PHONY: deploy-kind
deploy-kind:
test/utils/deploy-kind.sh

.PHONY: e2e-test
e2e-test: deploy-kind build-tests
./bin/tests --ginkgo.v --ginkgo.progress --kubeconfig=$$HOME/.kube/config
1 change: 1 addition & 0 deletions release-tools/travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ before_script:
- export PATH=$PWD/bin:$PATH
script:
- make -k all test GOFLAGS_VENDOR=$( [ -d vendor ] && echo '-mod=vendor' )
- make e2e-test
after_success:
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" quay.io;
Expand Down
35 changes: 35 additions & 0 deletions test/utils/deploy-kind.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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

KUBERNETES_VERSION=v1.18.8
KUBECONFIG=$HOME/.kube/config

# Setup and download kind
# 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
# 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/
# curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

sudo kind create cluster --image kindest/node:$KUBERNETES_VERSION
mkdir -p $HOME/.kube
sudo chown -R $USER: $HOME/.kube/
sudo kind get kubeconfig > $KUBECONFIG

echo "Seting up nfs-server-provisioner and deploying NFS CSI driver"

kubectl cluster-info
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

echo "Cluster is running"