test(backup): mock returns no-backing-chain for rsync-failure test

Phase 6 added a hasBackingChain() check before rsync that uses
qemu-img info to detect chained incrementals. The existing
testExecuteWithRsyncFailure test mocks Script.runSimpleBashScriptForExitValue
to return 0 for any command, so the new qemu-img info check
incorrectly evaluates as "has backing chain" and routes the test
through the chain-flatten path instead of rsync — the test then
asserts a failure that never occurs.

Add a clause to the mock that returns 1 (no backing chain) for the
qemu-img info backing-filename probe, so the test continues to
exercise the rsync path it was designed for.
This commit is contained in:
James Peru 2026-04-28 11:36:53 +03:00
parent 49edc7f22c
commit d80ed16723
1 changed files with 2 additions and 0 deletions

View File

@ -407,6 +407,8 @@ public class LibvirtRestoreBackupCommandWrapperTest {
return 0; // File exists
} else if (command.contains("qemu-img check")) {
return 0; // File is valid
} else if (command.contains("qemu-img info") && command.contains("backing-filename")) {
return 1; // No backing chain exercise the rsync path (full backups)
}
return 0; // Other commands success
});