Skip to content

Commit

Permalink
System tests: sdnotify: wait for socket file creation
Browse files Browse the repository at this point in the history
Potential race between starting socat (which creates a socket
file) and processes accessing said socket. Or maybe not. I
dunno, I'm grasping at straws. This is an elusive flake.

Fixes: #23798 (I hope)

Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Oct 1, 2024
1 parent 13b78c9 commit 4105378
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/system/260-sdnotify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ function _start_socat() {
(exec socat unix-recvfrom:"$NOTIFY_SOCKET",fork \
system:"(cat;echo) >> $_SOCAT_LOG" 3>&-) &
_SOCAT_PID=$!

# Wait for socat to create the socket file. This _should_ be
# instantaneous, but can take a few seconds under high load
for try in $(seq 1 10); do
if [[ -e "$NOTIFY_SOCKET" ]]; then
return
fi
sleep 0.5
done
die "Timed out waiting for socat to create $NOTIFY_SOCKET"
}

# Stop the socat background process and clean up logs
Expand Down

0 comments on commit 4105378

Please sign in to comment.