nixos/test-driver: keep streaming a container journal that is slow to appear

Poll for nspawn containers' journal for as long as needed rather than giving up
after ten seconds, ensuring we can still get output on slower nodes.

Before this change, resource-constrained environments or node parallelism could
make for a situation where it gave up before they loaded, preventing output
for the rest of the run.

Assisted-by: Claude:claude-opus-5
This commit is contained in:
cinereal
2026-08-16 11:36:37 +02:00
parent ea672a3a4a
commit d700b4d24f

View File

@@ -1809,15 +1809,16 @@ class NspawnMachine(BaseMachine):
# 1. Wait for the directory to actually be created by the container
self.log(f"Waiting for journal at {journal_path}...")
max_attempts = 10
warn_after = 10
attempts = 0
while not journal_path.exists() and attempts < max_attempts:
while not journal_path.exists():
if proc.poll() is not None:
self.log(f"Error: Journal directory {journal_path} never appeared.")
return
time.sleep(1)
attempts += 1
if not journal_path.exists():
self.log(f"Error: Journal directory {journal_path} never appeared.")
return
if attempts == warn_after:
self.log(f"Still waiting for journal at {journal_path}...")
# 2. Start the journalctl process
# Using a loop here handles cases where journalctl might exit unexpectedly