Skip to content

Commit d80ed16

Browse files
committed
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.
1 parent 49edc7f commit d80ed16

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapperTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ public void testExecuteWithRsyncFailure() throws Exception {
407407
return 0; // File exists
408408
} else if (command.contains("qemu-img check")) {
409409
return 0; // File is valid
410+
} else if (command.contains("qemu-img info") && command.contains("backing-filename")) {
411+
return 1; // No backing chain — exercise the rsync path (full backups)
410412
}
411413
return 0; // Other commands success
412414
});

0 commit comments

Comments
 (0)