From adb53c63dd975a4df106f60d289ff1e496e333c1 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Tue, 16 Apr 2019 10:26:00 +0300 Subject: [PATCH] Add e2e tests for A/B testing and pre/post hooks --- test/e2e-tests.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index eed594b6..1b0c52a0 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -83,7 +83,6 @@ spec: type: cmd cmd: "hey -z 10m -q 10 -c 2 http://podinfo.test:9898/" logCmdOutput: "true" - EOF echo '>>> Waiting for primary to be ready' @@ -126,6 +125,77 @@ done echo '✔ Canary promotion test passed' +cat <>> Triggering A/B testing' +kubectl -n test set image deployment/podinfo podinfod=quay.io/stefanprodan/podinfo:1.4.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 '1.4.2' && ok=true || ok=false + sleep 10 + kubectl -n istio-system logs deployment/flagger --tail 1 + count=$(($count + 1)) + if [[ ${count} -eq ${retries} ]]; then + kubectl -n test describe deployment/podinfo + kubectl -n test describe deployment/podinfo-primary + kubectl -n istio-system logs deployment/flagger + echo "No more retries left" + exit 1 + fi +done + +echo '✔ A/B testing promotion test passed' + kubectl -n istio-system logs deployment/flagger echo '✔ All tests passed' \ No newline at end of file