Skip to content

Commit fd8ba68

Browse files
reduce flakiness risk on port forward setup
Issue: ZENKO-5201
1 parent 64c1ca3 commit fd8ba68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/scripts/end2end/setup-e2e-env.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ if ! ss -tlnp 2>/dev/null | grep -q ":${MONGO_PORT}" && \
4444
trap "kill ${_MONGO_PF_PID} 2>/dev/null || true" EXIT
4545
export _SETUP_E2E_CLEANUP_SET=1
4646
fi
47-
sleep 2
47+
# Wait until the port is actually listening (poll every 200ms, fail after 10s)
48+
timeout 10 bash -c "until ss -tlnp 2>/dev/null | grep -q ':${MONGO_PORT}'; do sleep 0.2; done"
4849
fi
4950
export MONGO_REPLICA_SET_HOSTS="localhost:${MONGO_PORT}"
5051

0 commit comments

Comments
 (0)