Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions tests/framework/microvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from pathlib import Path
from typing import Optional

from tenacity import retry, stop_after_attempt, wait_fixed
from tenacity import Retrying, retry, stop_after_attempt, wait_fixed

import host_tools.cargo_build as build_tools
import host_tools.network as net_tools
Expand Down Expand Up @@ -481,8 +481,16 @@ def firecracker_pid(self):
"""
if not self._spawned:
return None
# Read the PID stored inside the file.
return int(self.jailer.pid_file.read_text(encoding="ascii"))

# Read the PID from Firecracker's pidfile. Retry if
# file doesn't exist yet, or doesn't yet contain an integer
for attempt in Retrying(
stop=stop_after_attempt(5),
wait=wait_fixed(0.1),
reraise=True,
):
with attempt:
return int(self.jailer.pid_file.read_text(encoding="ascii"))

@property
def dimensions(self):
Expand Down