From c4daa1c2609eec505ff9508e626a8957f60159f0 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 9 Apr 2020 17:21:37 -0700 Subject: [PATCH] Improve smoke test (#319) --- .github/workflows/ci.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2661a8f..4574b62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,8 @@ jobs: kubectl get nodes - name: Deploy From Source run: | - skaffold run + skaffold config set --global local-cluster true + skaffold run --default-repo local - name: Wait For Pods timeout-minutes: 20 run: | @@ -42,12 +43,16 @@ jobs: timeout-minutes: 5 run: | set -x - RESULT=" " - while [[ "$RESULT" != " HTTP/1.1 200 OK" ]]; do - sleep 1 - RESULT=$(kubectl exec deployments/frontend -- sh -c "wget --spider -S "http://frontend" 2>&1 | grep 'HTTP/'") - echo "front end response: $RESULT" + # start fresh loadgenerator pod + kubectl delete pod -l app=loadgenerator + # wait for requests to come in + REQUEST_COUNT="0" + while [[ "$REQUEST_COUNT" -lt "50" ]]; do + sleep 5 + REQUEST_COUNT=$(kubectl logs -l app=loadgenerator | grep Aggregated | awk '{print $2}') done - if [[ "$RESULT" != " HTTP/1.1 200 OK" ]]; then + # ensure there are no errors hitting endpoints + ERROR_COUNT=$(kubectl logs -l app=loadgenerator | grep Aggregated | awk '{print $3}' | sed "s/[(][^)]*[)]//g") + if [[ "$ERROR_COUNT" -gt "0" ]]; then exit 1 fi