Skip to content

Commit 2de83e7

Browse files
committed
ci: wait for connectable control socket in arch smoke test
1 parent f4c316c commit 2de83e7

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

bin/ci/smoke-agent-runtime.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ 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+
s.close()
56+
except Exception:
57+
sys.exit(1)
58+
" "$sock" 2>/dev/null
59+
}
60+
4761
wait_for_control_socket() {
4862
local deadline=$((SECONDS + START_TIMEOUT_SECONDS))
4963
local target=""
@@ -55,7 +69,7 @@ wait_for_control_socket() {
5569
if [[ "$target" != /* ]]; then
5670
target="${CONTROL_DIR}/${target}"
5771
fi
58-
if [[ -S "$target" ]]; then
72+
if [[ -S "$target" ]] && socket_is_connectable "$target"; then
5973
printf '%s\n' "$target"
6074
return 0
6175
fi

0 commit comments

Comments
 (0)