From adb53c63dd975a4df106f60d289ff1e496e333c1 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Tue, 16 Apr 2019 10:26:00 +0300 Subject: [PATCH 1/3] 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 From 50b7b74480ad177ca7f694a0d2117289e985cd95 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Tue, 16 Apr 2019 10:41:35 +0300 Subject: [PATCH 2/3] Speed up e2e tests by reducing the number of iterations --- test/e2e-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index 1b0c52a0..2ef1b7bc 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -42,7 +42,7 @@ spec: canaryAnalysis: interval: 15s threshold: 15 - maxWeight: 50 + maxWeight: 30 stepWeight: 10 metrics: - name: request-success-rate @@ -142,7 +142,7 @@ spec: canaryAnalysis: interval: 10s threshold: 5 - iterations: 10 + iterations: 5 match: - headers: cookie: From 15484363d61ab3399cfc483f0f73aed76e4ab62f Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Tue, 16 Apr 2019 11:00:03 +0300 Subject: [PATCH 3/3] Add A/B testing and hooks to e2e readme --- test/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/README.md b/test/README.md index b338d303..3f8d586b 100644 --- a/test/README.md +++ b/test/README.md @@ -5,7 +5,7 @@ The e2e testing infrastructure is powered by CircleCI and [Kubernetes Kind](http CircleCI e2e workflow: * install latest stable kubectl [e2e-kind.sh](e2e-kind.sh) -* build Kubernetes Kind from master [e2e-kind.sh](e2e-kind.sh) +* install Kubernetes Kind [e2e-kind.sh](e2e-kind.sh) * create local Kubernetes cluster with kind [e2e-kind.sh](e2e-kind.sh) * install latest stable Helm CLI [e2e-istio.sh](e2e-istio.sh) * deploy Tiller on the local cluster [e2e-istio.sh](e2e-istio.sh) @@ -18,7 +18,7 @@ CircleCI e2e workflow: * deploy the load tester in the test namespace [e2e-tests.sh](e2e-tests.sh) * deploy a demo workload (podinfo) in the test namespace [e2e-tests.sh](e2e-tests.sh) * test the canary initialization [e2e-tests.sh](e2e-tests.sh) -* test the canary analysis and promotion [e2e-tests.sh](e2e-tests.sh) - +* test the canary analysis and promotion using weighted traffic and the load testing webhook [e2e-tests.sh](e2e-tests.sh) +* test the A/B testing analysis and promotion using cookies filters and pre/post rollout webhooks [e2e-tests.sh](e2e-tests.sh)