From 336344720c80b51233db7ef81d2738ac10c275a6 Mon Sep 17 00:00:00 2001 From: mathetake Date: Sun, 23 Feb 2020 13:55:45 +0900 Subject: [PATCH] add e2e test for daemonset target type --- .circleci/config.yml | 23 +++- test/e2e-kubernetes-tests-daemonset.sh | 111 ++++++++++++++++++ ....sh => e2e-kubernetes-tests-deployment.sh} | 0 3 files changed, 130 insertions(+), 4 deletions(-) create mode 100755 test/e2e-kubernetes-tests-daemonset.sh rename test/{e2e-kubernetes-tests.sh => e2e-kubernetes-tests-deployment.sh} (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index c9093f34..05cdf0ad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,7 +82,7 @@ jobs: - run: test/e2e-istio.sh - run: test/e2e-tests.sh - e2e-kubernetes-testing: + e2e-kubernetes-daemonset-testing: machine: true steps: - checkout @@ -91,7 +91,18 @@ jobs: - run: test/container-build.sh - run: test/e2e-kind.sh v1.17.0 - run: test/e2e-kubernetes.sh - - run: test/e2e-kubernetes-tests.sh + - run: test/e2e-kubernetes-tests-daemonset.sh + + e2e-kubernetes-deployment-testing: + machine: true + steps: + - checkout + - attach_workspace: + at: /tmp/bin + - run: test/container-build.sh + - run: test/e2e-kind.sh v1.17.0 + - run: test/e2e-kubernetes.sh + - run: test/e2e-kubernetes-tests-deployment.sh e2e-kubernetes-svc-testing: machine: true @@ -215,7 +226,10 @@ workflows: - e2e-istio-testing: requires: - build-binary - - e2e-kubernetes-testing: + - e2e-kubernetes-daemonset-testing: + requires: + - build-binary + - e2e-kubernetes-deployment-testing: requires: - build-binary - e2e-gloo-testing: @@ -234,7 +248,8 @@ workflows: requires: - build-binary - e2e-istio-testing - - e2e-kubernetes-testing + - e2e-kubernetes-daemonset-testing + - e2e-kubernetes-deployment-testing - e2e-gloo-testing - e2e-nginx-testing - e2e-linkerd-testing diff --git a/test/e2e-kubernetes-tests-daemonset.sh b/test/e2e-kubernetes-tests-daemonset.sh new file mode 100755 index 00000000..0d70c08d --- /dev/null +++ b/test/e2e-kubernetes-tests-daemonset.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash + +# This script runs e2e tests for Blue/Green initialization, analysis and promotion +# Prerequisites: Kubernetes Kind, Kustomize + +set -o errexit + +REPO_ROOT=$(git rev-parse --show-toplevel) + +echo '>>> Creating test namespace' +kubectl create namespace test + +echo '>>> Installing the load tester' +kubectl apply -k ${REPO_ROOT}/kustomize/tester +kubectl -n test rollout status deployment/flagger-loadtester + +echo '>>> Initialising canary' +kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml + +cat <>> Waiting for primary to be ready' +retries=50 +count=0 +ok=false +until ${ok}; do + kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false + sleep 5 + count=$(($count + 1)) + if [[ ${count} -eq ${retries} ]]; then + kubectl -n flagger-system logs deployment/flagger + echo "No more retries left" + exit 1 + fi +done + +echo '✔ Canary initialization test passed' + +echo '>>> Triggering canary daemonset' +kubectl -n test set image daemonset/podinfo podinfod=stefanprodan/podinfo:3.1.1 + +echo '>>> Waiting for canary promotion' +retries=50 +count=0 +ok=false +until ${ok}; do + kubectl -n test describe daemonset/podinfo-primary | grep '3.1.1' && ok=true || ok=false + sleep 10 + kubectl -n flagger-system logs deployment/flagger --tail 1 + count=$(($count + 1)) + if [[ ${count} -eq ${retries} ]]; then + kubectl -n test describe daemonset/podinfo + kubectl -n test describe daemonset/podinfo-primary + kubectl -n flagger-system logs deployment/flagger + echo "No more retries left" + exit 1 + fi +done + +echo '✔ Canary promotion test passed' + +kubectl -n flagger-system logs deployment/flagger diff --git a/test/e2e-kubernetes-tests.sh b/test/e2e-kubernetes-tests-deployment.sh similarity index 100% rename from test/e2e-kubernetes-tests.sh rename to test/e2e-kubernetes-tests-deployment.sh