Start the smoke's action when its listener is on the server, not after 3 s

roundtrip started the listener in the background, waited a fixed 3 s and ran
the action (the poke, the private message, the avatar request, the file
upload). A dev server that is slow to let a client in (4 s and more, 13 s
seen, when the machine is busy) left the action running against a client that
was not on the server yet: `error: message: the client is not on the server`,
and `FAIL: private message: the action failed` (the action's client printed
`connected: 2 clients` and the listener's `connected: 1 clients` came after).
That is one of the places at which the earlier steps of the smoke flaked.

voelinctl engine prints `connected: N clients` once its client is on the
server and has seen the presence, for every action; roundtrip now waits for
that line in the listener's log (60 s at most, and not when the listener has
ended) and then 1 s more, for the others on the server to see the listener.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-25 03:30:02 +03:00
1 parent 069fd2ac12
commit 5c029a982a
1 file changed
+12 -2
+12 -2
View File
@@ -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"