Allow to use a custom k8s version in e2e tests

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-05-15 12:34:17 -04:00
parent 87b730d5fe
commit d32079e69c
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
3 changed files with 20 additions and 15 deletions

View file

@ -12,13 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Running make run-in-docker allows the execution of a target
# using a container intead of running the command locally
ifeq (run-in-docker,$(firstword $(MAKECMDGOALS)))
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(RUN_ARGS):;@:)
endif
.PHONY: all
all: all-container
@ -36,6 +29,7 @@ FOCUS ?= .*
E2E_NODES ?= 10
# slow test only if takes > 50s
SLOW_E2E_THRESHOLD ?= 50
K8S_VERSION ?= v1.14.1
ifeq ($(GOHOSTOS),darwin)
SED_I=sed -i ''
@ -59,12 +53,14 @@ QEMUVERSION = v4.0.0
BUSTED_ARGS =-v --pattern=_test
export ARCH
export DUMB_ARCH
export TAG
export PKG
export GOARCH
export GIT_COMMIT
export GOBUILD_FLAGS
export REPO_INFO
export BUSTED_ARGS
IMGNAME = nginx-ingress-controller
IMAGE = $(REGISTRY)/$(IMGNAME)
@ -252,7 +248,3 @@ misspell:
.PHONE: kind-e2e-test
kind-e2e-test:
test/e2e/run.sh
.PHONE: run-in-docker
run-in-docker:
# dummy target

View file

@ -59,7 +59,6 @@ docker run \
${MINIKUBE_VOLUME} \
-w /go/src/${PKG} \
--env-file .env \
--entrypoint ${FLAGS} \
${E2E_IMAGE}
${E2E_IMAGE} ${FLAGS}
rm .env

View file

@ -14,8 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
KIND_LOG_LEVEL="info"
if ! [ -z $DEBUG ]; then
set -x
set -x
KIND_LOG_LEVEL="debug"
fi
set -o errexit
@ -28,12 +31,19 @@ export TAG=dev
export ARCH=amd64
export REGISTRY=ingress-controller
export K8S_VERSION=${K8S_VERSION:-v1.14.1}
KIND_CLUSTER_NAME="ingress-nginx-dev"
kind --version || $(echo "Please install kind before running e2e tests";exit 1)
echo "[dev-env] creating Kubernetes cluster with kind"
kind create cluster --name ${KIND_CLUSTER_NAME} --config ${DIR}/kind.yaml
# TODO: replace the custom images after https://github.com/kubernetes-sigs/kind/issues/531
kind create cluster \
--loglevel=${KIND_LOG_LEVEL} \
--name ${KIND_CLUSTER_NAME} \
--config ${DIR}/kind.yaml \
--image "aledbf/kind-node:${K8S_VERSION}"
export KUBECONFIG="$(kind get kubeconfig-path --name="${KIND_CLUSTER_NAME}")"
@ -52,3 +62,7 @@ kind load docker-image --name="${KIND_CLUSTER_NAME}" ${REGISTRY}/nginx-ingress-c
echo "[dev-env] running e2e tests..."
make -C ${DIR}/../../ e2e-test
kind delete cluster \
--loglevel=${KIND_LOG_LEVEL} \
--name ${KIND_CLUSTER_NAME}