test: skip systemd-run boilerplate in rsync errors, add raw retry
This commit is contained in:
@@ -345,14 +345,32 @@ path = {source_dir}
|
|||||||
errors = []
|
errors = []
|
||||||
if rsync_result.returncode != 0:
|
if rsync_result.returncode != 0:
|
||||||
errs = []
|
errs = []
|
||||||
if rsync_result.stderr:
|
for line in (rsync_result.stderr or "").split("\n"):
|
||||||
errs.append(rsync_result.stderr.strip().split("\n")[0])
|
line = line.strip()
|
||||||
if rsync_result.stdout:
|
if not line:
|
||||||
errs.append(rsync_result.stdout.strip().split("\n")[0])
|
continue
|
||||||
|
if line.startswith("Running as unit:"):
|
||||||
|
continue
|
||||||
|
errs.append(line)
|
||||||
|
for line in (rsync_result.stdout or "").split("\n"):
|
||||||
|
line = line.strip()
|
||||||
|
if not line:
|
||||||
|
continue
|
||||||
|
errs.append(line)
|
||||||
if not errs:
|
if not errs:
|
||||||
errs.append("No output")
|
errs.append("No output")
|
||||||
err = " | ".join(errs)
|
err = " | ".join(errs[-3:])
|
||||||
errors.append(f"Exit code {rsync_result.returncode}: {err[:150]}")
|
errors.append(f"Exit code {rsync_result.returncode}: {err[:200]}")
|
||||||
|
# Retry without systemd-run to reveal the actual error
|
||||||
|
if client_prefix:
|
||||||
|
plain = subprocess.run(
|
||||||
|
["rsync", "-aH", f"rsync://localhost:{rsync_port}/source/", "/tmp/"],
|
||||||
|
capture_output=True, text=True, timeout=30
|
||||||
|
)
|
||||||
|
if plain.returncode != 0:
|
||||||
|
plain_errs = [l for l in (plain.stderr or "").split("\n") if l.strip()]
|
||||||
|
if plain_errs:
|
||||||
|
errors.append(f"raw: {plain_errs[-1][:150]}")
|
||||||
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user