Skip to content

Commit

Permalink
tests/backup: compare property value only if non-default
Browse files Browse the repository at this point in the history
Default property value may intentionally differ - for example if
template is different. Compare specific property value after restoring
only if it was set to non-default value.
  • Loading branch information
marmarek committed Dec 16, 2022
1 parent a769de1 commit 804aa5a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions qubes/tests/integ/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,17 @@ def assertCorrectlyRestored(self, vms_info, orig_hashes):
self.assertIn(vm_name, self.app.domains)
restored_vm = self.app.domains[vm_name]
for prop in vm_info['properties']:
self.assertEqual(
vm_info['properties'][prop],
str(getattr(restored_vm, prop)),
"VM {} - property {} not properly restored".format(
vm_name, prop))
self.assertEqual(
vm_info['default'][prop],
restored_vm.property_is_default(prop),
"VM {} - property {} differs in being default".format(
vm_name, prop))
if not vm_info['default'][prop]:
self.assertEqual(
vm_info['properties'][prop],
str(getattr(restored_vm, prop)),
"VM {} - property {} not properly restored".format(
vm_name, prop))
for dev_class in vm_info['devices']:
for dev in vm_info['devices'][dev_class]:
found = False
Expand Down

0 comments on commit 804aa5a

Please sign in to comment.