From ae9cf57fd5bc5ad2e9cb61d05378fc97eb7ae3e3 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Thu, 19 Dec 2019 12:03:52 +0200 Subject: [PATCH] Add e2e tests for Contour header routing --- test/e2e-contour-tests.sh | 83 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/test/e2e-contour-tests.sh b/test/e2e-contour-tests.sh index 2f97dd3e..934fbeef 100755 --- a/test/e2e-contour-tests.sh +++ b/test/e2e-contour-tests.sh @@ -82,7 +82,7 @@ spec: timeout: 5s metadata: type: cmd - cmd: "hey -z 2m -q 5 -c 2 -host app.example.com http://envoy.projectcontour" + cmd: "hey -z 1m -q 5 -c 2 -host app.example.com http://envoy.projectcontour" logCmdOutput: "true" EOF @@ -127,4 +127,85 @@ until ${ok}; do fi done +echo '>>> Waiting for canary finalization' +retries=50 +count=0 +ok=false +until ${ok}; do + kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false + sleep 5 + 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 promotion test passed' + +cat <>> Triggering A/B testing' +kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.2 + +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 + 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 '✔ A/B testing promotion test passed' + +kubectl -n projectcontour logs deployment/flagger + +echo '✔ All tests passed' \ No newline at end of file