ci: fail faster in helm tests

This commit is contained in:
Ivan Dyachkov 2023-08-04 08:04:49 +02:00
parent 93197137e7
commit d100acf701
1 changed files with 5 additions and 12 deletions

View File

@ -99,26 +99,19 @@ jobs:
sleep 10; sleep 10;
done done
- name: Get Token - name: Get Token
timeout-minutes: 1
run: | run: |
kubectl port-forward service/${EMQX_NAME} 18083:18083 > /dev/null & kubectl port-forward service/${EMQX_NAME} 18083:18083 > /dev/null &
curl --head -X GET --retry 10 --retry-connrefused --retry-delay 6 http://localhost:18083/status
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
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 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 - name: Check cluster
timeout-minutes: 10 timeout-minutes: 1
run: | run: |
while 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 do
echo "waiting ${EMQX_NAME} cluster scale" echo "waiting ${EMQX_NAME} cluster scale. Current live nodes: $nodes_length."
sleep 1 sleep 1
done done
- uses: actions/checkout@v3 - uses: actions/checkout@v3