diff --git a/scripts/it-smoke.sh b/scripts/it-smoke.sh index 12990ff..2f2c71b 100755 --- a/scripts/it-smoke.sh +++ b/scripts/it-smoke.sh @@ -413,12 +413,22 @@ server_uid() { "$VOELINCTL" identity show --identity "$id" | awk -v f="$field:" '$1 == f { print $2 }' } -# Run a background listener, then the action; both must succeed. +# Run a background listener, then the action; both must succeed. The action +# starts once the listener says it is on the server ("connected: N clients", +# which voelinctl engine prints for every action): a fixed pause of 3 s sent +# the poke, the private message or the avatar request to a client that was not +# on the server yet whenever the dev server was slow to let one in ("the +# client is not on the server"; a loaded dev server takes 4 to 13 s). roundtrip() { local what=$1 listen_log=$2 listener_cmd=$3 action_cmd=$4 eval "$listener_cmd" >"$listen_log" 2>&1 & local listener=$! - sleep 3 + for _ in $(seq 1 240); do + grep -q '^connected:' "$listen_log" 2>/dev/null && break + kill -0 "$listener" 2>/dev/null || break + sleep 0.25 + done + sleep 1 if ! eval "$action_cmd" >"$STATE_DIR/action.log" 2>&1; then cat "$STATE_DIR/action.log" "$listen_log" fail "$what: the action failed"