From d32079e69c0fd26baa1b72e4fe7f40b08e769491 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Wed, 15 May 2019 12:34:17 -0400 Subject: [PATCH] Allow to use a custom k8s version in e2e tests --- Makefile | 14 +++----------- build/{go-in-docker.sh => run-in-docker.sh} | 3 +-- test/e2e/run.sh | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 15 deletions(-) rename build/{go-in-docker.sh => run-in-docker.sh} (96%) diff --git a/Makefile b/Makefile index 5c27b4a23..fc409fd7e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/build/go-in-docker.sh b/build/run-in-docker.sh similarity index 96% rename from build/go-in-docker.sh rename to build/run-in-docker.sh index d3e83b87a..ac2b124de 100755 --- a/build/go-in-docker.sh +++ b/build/run-in-docker.sh @@ -59,7 +59,6 @@ docker run \ ${MINIKUBE_VOLUME} \ -w /go/src/${PKG} \ --env-file .env \ - --entrypoint ${FLAGS} \ - ${E2E_IMAGE} + ${E2E_IMAGE} ${FLAGS} rm .env diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 404f9f743..580a4b084 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -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}