From d100acf701feae82491decb4342e288108fd0385 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Fri, 4 Aug 2023 08:04:49 +0200 Subject: [PATCH] ci: fail faster in helm tests --- .github/workflows/run_helm_tests.yaml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run_helm_tests.yaml b/.github/workflows/run_helm_tests.yaml index 85e748da4..1106b6057 100644 --- a/.github/workflows/run_helm_tests.yaml +++ b/.github/workflows/run_helm_tests.yaml @@ -99,26 +99,19 @@ jobs: sleep 10; done - name: Get Token - timeout-minutes: 1 run: | kubectl port-forward service/${EMQX_NAME} 18083:18083 > /dev/null & - - while - [ "$(curl --silent -X 'GET' 'http://127.0.0.1:18083/api/v5/status' | tail -n1)" != "emqx is running" ] - do - echo "waiting emqx" - sleep 1 - done - + curl --head -X GET --retry 10 --retry-connrefused --retry-delay 6 http://localhost:18083/status echo "TOKEN=$(curl --silent -X 'POST' 'http://127.0.0.1:18083/api/v5/login' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"username": "admin","password": "public"}' | jq -r ".token")" >> $GITHUB_ENV - name: Check cluster - timeout-minutes: 10 + timeout-minutes: 1 run: | while - [ "$(curl --silent -H "Authorization: Bearer $TOKEN" -X GET http://127.0.0.1:18083/api/v5/cluster| jq '.nodes|length')" != "3" ]; + nodes_length="$(curl --silent -H "Authorization: Bearer $TOKEN" -X GET http://127.0.0.1:18083/api/v5/cluster| jq '.nodes|length')" + [ $nodes_length != "3" ] do - echo "waiting ${EMQX_NAME} cluster scale" + echo "waiting ${EMQX_NAME} cluster scale. Current live nodes: $nodes_length." sleep 1 done - uses: actions/checkout@v3