From f451b4e36c00194feccdac5abff372fb1415ec33 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sun, 24 Feb 2019 02:52:25 +0200 Subject: [PATCH] Split e2e prerequisites --- .circleci/config.yml | 3 ++- test/e2e-istio.sh | 29 ++++++++++++++++++++++ test/{e2e-prerequisites.sh => e2e-kind.sh} | 8 +----- test/e2e-tests.sh | 26 ++++++------------- 4 files changed, 40 insertions(+), 26 deletions(-) create mode 100755 test/e2e-istio.sh rename test/{e2e-prerequisites.sh => e2e-kind.sh} (66%) diff --git a/.circleci/config.yml b/.circleci/config.yml index bd90165d..eb4639d0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,8 @@ jobs: machine: true steps: - checkout - - run: test/e2e-prerequisites.sh + - run: test/e2e-kind.sh + - run: test/e2e-istio.sh - run: test/e2e-tests.sh workflows: diff --git a/test/e2e-istio.sh b/test/e2e-istio.sh new file mode 100755 index 00000000..98753e34 --- /dev/null +++ b/test/e2e-istio.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -o errexit + +ISTIO_VER="1.1.0-rc.0" +REPO_ROOT=$(git rev-parse --show-toplevel) + +export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" + +echo ">>> Installing Helm" +curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash + +echo '>>> Installing Tiller' +kubectl --namespace kube-system create sa tiller +kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller +helm init --service-account tiller --upgrade --wait + +echo ">>> Installing Istio ${ISTIO_VER}" +helm repo add istio.io https://storage.googleapis.com/istio-release/releases/${ISTIO_VER}/charts + +echo '>>> Installing Istio CRDs' +helm upgrade -i istio-init istio.io/istio-init --wait --namespace istio-system + +echo '>>> Waiting for Istio CRDs to be ready' +kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-10 +kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-11 + +echo 'Installing Istio control plane' +helm upgrade -i istio istio.io/istio --wait --namespace istio-system -f ${REPO_ROOT}/test/e2e-istio-values.yaml \ No newline at end of file diff --git a/test/e2e-prerequisites.sh b/test/e2e-kind.sh similarity index 66% rename from test/e2e-prerequisites.sh rename to test/e2e-kind.sh index 6e7996f9..2312aebe 100755 --- a/test/e2e-prerequisites.sh +++ b/test/e2e-kind.sh @@ -21,11 +21,5 @@ sudo mv kind /usr/local/bin/ kind create cluster --wait 5m export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" +kubectl get pods --all-namespaces -echo ">>> Installing helm" -curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash - -echo '>>> Installing tiller' -kubectl --namespace kube-system create sa tiller -kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller -helm init --service-account tiller --upgrade --wait diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index 2881b7fc..975dd636 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -2,25 +2,9 @@ set -o errexit -ISTIO_VER="1.1.0-rc.0" REPO_ROOT=$(git rev-parse --show-toplevel) export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" -echo ">>> Starting e2e testing using Istio ${ISTIO_VER}" -helm repo add istio.io https://storage.googleapis.com/istio-release/releases/${ISTIO_VER}/charts - -echo '>>> Installing Istio CRDs' -helm upgrade -i istio-init istio.io/istio-init --wait --namespace istio-system - -echo '>>> Waiting for Istio CRDs to be ready' -kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-10 -kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-11 - -echo 'Installing Istio control plane' -helm upgrade -i istio istio.io/istio --wait --namespace istio-system -f ${REPO_ROOT}/test/e2e-istio-values.yaml - -export KUBECONFIG="$(kind get kubeconfig-path)" - echo '>>> Building Flagger' cd ${REPO_ROOT} && docker build -t test/flagger:latest . -f Dockerfile @@ -56,8 +40,8 @@ spec: service: port: 9898 canaryAnalysis: - interval: 10s - threshold: 10 + interval: 15s + threshold: 15 maxWeight: 50 stepWeight: 10 metrics: @@ -85,6 +69,7 @@ until ${ok}; do sleep 5 count=$(($count + 1)) if [[ ${count} -eq ${retries} ]]; then + kubectl -n istio-system logs deployment/flagger echo "No more retries left" exit 1 fi @@ -104,9 +89,14 @@ until ${ok}; do sleep 5 count=$(($count + 1)) if [[ ${count} -eq ${retries} ]]; then + kubectl -n istio-system logs deployment/flagger echo "No more retries left" exit 1 fi done echo '>>> Canary promotion test passed ✔︎' + +kubectl -n istio-system logs deployment/flagger + +echo '>>> All tests passed ✔︎' \ No newline at end of file