Skip to content

Commit 6339d18

Browse files
pncclaude
andcommitted
Handle SSH timeout in cloud-init polling loop
Under TCG on CI, cloud-init status can take longer than 15s to respond while packages are installing. Catch TimeoutExpired and retry instead of crashing the test. Also bumped the per-poll timeout from 15s to 30s. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 800a84a commit 6339d18

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/test_e2e.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@ def test_cloud_init_success(running_vm):
240240
deadline = time.monotonic() + 300
241241
last_detail = ""
242242
while time.monotonic() < deadline:
243-
r = _vm_ssh("cloud-init status --long 2>&1", timeout=15)
243+
try:
244+
r = _vm_ssh("cloud-init status --long 2>&1", timeout=30)
245+
except subprocess.TimeoutExpired:
246+
remaining = int(deadline - time.monotonic())
247+
_progress(f"cloud-init ({remaining}s left): (SSH timed out, retrying)")
248+
continue
244249
remaining = int(deadline - time.monotonic())
245250
# Compact multi-line status into a single progress line.
246251
detail = " | ".join(

0 commit comments

Comments
 (0)