Skip to content

Commit cfcdae5

Browse files
authored
ci: fix flaky test (#260)
1 parent bbeca6c commit cfcdae5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
HOST_ADDR: ${{ env.HOST_IP_ADDR }}
9999
- name: Wait for nodes to be ready
100100
run: |
101-
node_cnt=$(docker compose -f $DOCKER_COMPOSE_FILE ps | tail -n +2 | wc -l)
101+
node_cnt=$(docker compose -f $DOCKER_COMPOSE_FILE ps --format json | jq -s 'length')
102102
i=0
103103
while :
104104
do
@@ -107,7 +107,7 @@ jobs:
107107
echo "Max attempts exceeded: $i times"
108108
exit 1
109109
fi
110-
healthy_cnt=$(docker compose -f $DOCKER_COMPOSE_FILE ps --format json | (jq .[].Status || true) | (grep healthy || true) | wc -l)
110+
healthy_cnt=$(docker compose -f $DOCKER_COMPOSE_FILE ps --format json | jq -s 'map(select(.Health == "healthy")) | length')
111111
if [[ $healthy_cnt -eq $node_cnt ]]
112112
then
113113
break
@@ -117,7 +117,7 @@ jobs:
117117
: $((++i))
118118
done
119119
env:
120-
MAX_ATTEMPTS: "20"
120+
MAX_ATTEMPTS: "10"
121121
- name: Print containers
122122
run: docker compose -f $DOCKER_COMPOSE_FILE ps
123123
- name: Build cluster

0 commit comments

Comments
 (0)