From 15446102037b4de0ec684641a93b6debd18fdd99 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Fri, 20 Dec 2019 14:38:06 +0200 Subject: [PATCH] Add Contour e2e test for canary rollback --- test/e2e-contour-tests.sh | 78 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/test/e2e-contour-tests.sh b/test/e2e-contour-tests.sh index 934fbeef..a5bdb9b7 100755 --- a/test/e2e-contour-tests.sh +++ b/test/e2e-contour-tests.sh @@ -144,6 +144,80 @@ done echo '✔ Canary promotion test passed' + +cat <>> Triggering canary deployment' +kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.2 + +echo '>>> Waiting for canary rollback' +retries=50 +count=0 +ok=false +until ${ok}; do + kubectl -n test get canary/podinfo | grep 'Failed' && ok=true || ok=false + sleep 10 + kubectl -n projectcontour logs deployment/flagger --tail 1 + count=$(($count + 1)) + if [[ ${count} -eq ${retries} ]]; then + kubectl -n projectcontour logs deployment/flagger + echo "No more retries left" + exit 1 + fi +done + +echo '✔ Canary rollback test passed' + cat <>> Triggering A/B testing' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.2 +kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.3 echo '>>> Waiting for A/B testing promotion' retries=50 count=0 ok=false until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.2' && ok=true || ok=false + kubectl -n test describe deployment/podinfo-primary | grep '3.1.3' && ok=true || ok=false sleep 10 kubectl -n projectcontour logs deployment/flagger --tail 1 count=$(($count + 1))