tests: Allow dump test exit code 30 (warnings)

This commit is contained in:
deajan 2025-09-09 23:54:29 +02:00
parent edf363562f
commit b206ba9acf

View file

@ -500,13 +500,14 @@ def test_npbackup_cli_dump():
Don't use RedirectedStdout since dump will output binary data
"""
print("DUMPING FILE", DUMP_FILE_RESTIC_PATH, "TO", DUMP_FILE_RESTORED)
cmd = f"{sys.executable} ..{os.sep}npbackup{os.sep}bin{os.sep}npbackup-cli -c {CONF_FILE} --debug --dump {DUMP_FILE_RESTIC_PATH} > {DUMP_FILE_RESTORED}"
cmd = f"{sys.executable} ..{os.sep}npbackup{os.sep}bin{os.sep}npbackup-cli -c {CONF_FILE} --dump {DUMP_FILE_RESTIC_PATH} > {DUMP_FILE_RESTORED}"
print(cmd)
exit_code, output = command_runner(cmd, shell=True)
print(exit_code, output)
with open(DUMP_FILE_RESTORED, "rb") as f:
print(f"Restored file {DUMP_FILE_RESTORED} contents:\n{f.read()}")
assert exit_code == 0, "Dump command failed"
# Allow exit code 30 because we get a warning for the log file creation
assert exit_code in (0, 30), "Dump command failed"
original_sha = sha256sum(os.path.join("..", "npbackup", "npbackup", DUMP_FILE))
restored_sha = sha256sum(DUMP_FILE_RESTORED)