From 51c6e950a3523a3239bc64afa1a0e28789777de5 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Tue, 26 Feb 2019 12:32:53 -0300 Subject: [PATCH] Fix e2e test in osx --- Makefile | 14 +++++----- test/e2e-image/Dockerfile | 17 +++++++----- test/e2e-image/Makefile | 8 +----- test/e2e-image/wait-for-nginx.sh | 44 -------------------------------- 4 files changed, 20 insertions(+), 63 deletions(-) delete mode 100755 test/e2e-image/wait-for-nginx.sh diff --git a/Makefile b/Makefile index f15ca0e9dc..421cd7a17d 100644 --- a/Makefile +++ b/Makefile @@ -185,10 +185,10 @@ e2e-test: echo "Granting permissions to ingress-nginx e2e service account..." kubectl create serviceaccount ingress-nginx-e2e || true kubectl create clusterrolebinding permissive-binding \ - --clusterrole=cluster-admin \ - --user=admin \ - --user=kubelet \ - --serviceaccount=default:ingress-nginx-e2e || true + --clusterrole=cluster-admin \ + --user=admin \ + --user=kubelet \ + --serviceaccount=default:ingress-nginx-e2e || true kubectl run --rm -i --tty \ --attach \ @@ -202,12 +202,14 @@ e2e-test: .PHONY: e2e-test-image e2e-test-image: + make -C test/e2e-image + +.PHONY: e2e-test-binary +e2e-test-binary: @$(DEF_VARS) \ DOCKER_OPTS="-i --net=host" \ build/go-in-docker.sh build/build-e2e.sh - make -C test/e2e-image - .PHONY: cover cover: @$(DEF_VARS) \ diff --git a/test/e2e-image/Dockerfile b/test/e2e-image/Dockerfile index 593c59c5a4..0b969ca9ea 100644 --- a/test/e2e-image/Dockerfile +++ b/test/e2e-image/Dockerfile @@ -1,17 +1,22 @@ +FROM quay.io/kubernetes-ingress-controller/e2e:v02252019-286c1f306 AS BASE + FROM quay.io/kubernetes-ingress-controller/debian-base-amd64:0.1 RUN clean-install \ ca-certificates \ bash \ + curl \ tzdata -COPY ginkgo /usr/local/bin/ -COPY kubectl /usr/local/bin/ -COPY e2e.sh /e2e.sh +RUN curl -Lo /usr/local/bin/kubectl \ + https://storage.googleapis.com/kubernetes-release/release/v1.13.3/bin/linux/amd64/kubectl \ + && chmod +x /usr/local/bin/kubectl -COPY manifests /manifests +COPY --from=BASE /go/bin/ginkgo /usr/local/bin/ -COPY wait-for-nginx.sh / -COPY e2e.test / +COPY e2e.sh /e2e.sh +COPY manifests /manifests +COPY wait-for-nginx.sh / +COPY e2e.test / CMD [ "/e2e.sh" ] diff --git a/test/e2e-image/Makefile b/test/e2e-image/Makefile index 494a21c68f..f64d2c26a1 100644 --- a/test/e2e-image/Makefile +++ b/test/e2e-image/Makefile @@ -1,17 +1,11 @@ IMAGE=nginx-ingress-controller:e2e -KUBE_VERSION ?= 1.13.3 .PHONY: all container getbins clean all: container container: - ./kubectl > /dev/null 2>&1 || curl -Lo ./kubectl \ - https://storage.googleapis.com/kubernetes-release/release/v$(KUBE_VERSION)/bin/linux/amd64/kubectl \ - && chmod +x ./kubectl - - $(GOPATH)/bin/ginkgo > /dev/null 2>&1 || go get github.com/onsi/ginkgo/ginkgo - cp $(GOPATH)/bin/ginkgo . + make -C ../../ e2e-test-binary cp ../e2e/e2e.test . cp ../e2e/wait-for-nginx.sh . diff --git a/test/e2e-image/wait-for-nginx.sh b/test/e2e-image/wait-for-nginx.sh deleted file mode 100755 index 250c32c6b6..0000000000 --- a/test/e2e-image/wait-for-nginx.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# Copyright 2017 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. - -set -e -set -x - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -export NAMESPACE=$1 - -echo "deploying NGINX Ingress controller in namespace $NAMESPACE" - -function on_exit { - local error_code="$?" - - test $error_code == 0 && return; - - echo "Obtaining ingress controller pod logs..." - kubectl logs -l app.kubernetes.io/name=ingress-nginx -n $NAMESPACE -} -trap on_exit EXIT - -kubectl apply --f $DIR/manifests/service.yaml -sed "s@\${NAMESPACE}@${NAMESPACE}@" $DIR/manifests/mandatory.yaml | kubectl apply --namespace=$NAMESPACE -f - -cat $DIR/manifests/service.yaml | kubectl apply --namespace=$NAMESPACE -f - - -# wait for the deployment and fail if there is an error before starting the execution of any test -kubectl rollout status \ - --request-timeout=3m \ - --namespace $NAMESPACE \ - deployment nginx-ingress-controller