Skip to content

Commit 9f6671e

Browse files
authored
ci: fix Arch integration control-socket readiness check (#204)
1 parent f4c316c commit 9f6671e

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

bin/ci/smoke-agent-runtime.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ cleanup() {
4444
}
4545
trap cleanup EXIT
4646

47+
socket_is_connectable() {
48+
local sock="$1"
49+
sudo -u "$AGENT_USER" python3 -c "
50+
import socket, sys
51+
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
52+
try:
53+
s.settimeout(2)
54+
s.connect(sys.argv[1])
55+
except Exception:
56+
sys.exit(1)
57+
finally:
58+
s.close()
59+
" "$sock" 2>/dev/null
60+
}
61+
4762
wait_for_control_socket() {
4863
local deadline=$((SECONDS + START_TIMEOUT_SECONDS))
4964
local target=""
@@ -55,7 +70,7 @@ wait_for_control_socket() {
5570
if [[ "$target" != /* ]]; then
5671
target="${CONTROL_DIR}/${target}"
5772
fi
58-
if [[ -S "$target" ]]; then
73+
if [[ -S "$target" ]] && socket_is_connectable "$target"; then
5974
printf '%s\n' "$target"
6075
return 0
6176
fi

0 commit comments

Comments
 (0)