test: use temp dir for rsync error retry

This commit is contained in:
2026-07-05 19:06:25 +02:00
parent 251d2a3407
commit 7d528b1b4d
+5 -1
View File
@@ -361,14 +361,18 @@ read only = yes
errors.append(f"Exit code {rsync_result.returncode}: {err[:200]}") errors.append(f"Exit code {rsync_result.returncode}: {err[:200]}")
# Retry without systemd-run to reveal the actual error # Retry without systemd-run to reveal the actual error
if client_prefix: if client_prefix:
tmp_dest = tempfile.mkdtemp()
try:
plain = subprocess.run( plain = subprocess.run(
["rsync", "-aH", f"rsync://localhost:{rsync_port}/source/", "/tmp/"], ["rsync", "-aH", f"rsync://localhost:{rsync_port}/source/", f"{tmp_dest}/"],
capture_output=True, text=True, timeout=30 capture_output=True, text=True, timeout=30
) )
if plain.returncode != 0: if plain.returncode != 0:
plain_errs = [l for l in (plain.stderr or "").split("\n") if l.strip()] plain_errs = [l for l in (plain.stderr or "").split("\n") if l.strip()]
if plain_errs: if plain_errs:
errors.append(f"raw: {plain_errs[-1][:150]}") errors.append(f"raw: {plain_errs[-1][:150]}")
finally:
shutil.rmtree(tmp_dest, ignore_errors=True)
if missing: if missing:
errors.append(f"Missing ({len(missing)}): {', '.join(missing[:5])}") errors.append(f"Missing ({len(missing)}): {', '.join(missing[:5])}")
if mismatches: if mismatches: