From a769de1be85fc1e661a2d479804478ecec91fe7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 16 Dec 2022 23:46:36 +0100 Subject: [PATCH 1/2] tests: clone properties too when cloning a template This is especially relevant if extra kernel options are necessary - for example for SELinux, otherwise full relabel will be started (and will timeout the VM start). But there may be other cases too. --- qubes/tests/integ/grub.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qubes/tests/integ/grub.py b/qubes/tests/integ/grub.py index abed4f071..2355b735f 100644 --- a/qubes/tests/integ/grub.py +++ b/qubes/tests/integ/grub.py @@ -97,6 +97,7 @@ def test_000_standalone_vm(self): label='red') self.testvm1.virt_mode = self.virt_mode self.testvm1.features.update(self.app.domains[self.template].features) + self.testvm1.clone_properties(self.app.domains[self.template]) self.loop.run_until_complete( self.testvm1.clone_disk_files(self.app.domains[self.template])) self.loop.run_until_complete(self.testvm1.start()) @@ -117,6 +118,7 @@ def test_010_template_based_vm(self): name=self.make_vm_name('template'), label='red') self.test_template.virt_mode = self.virt_mode self.test_template.features.update(self.app.domains[self.template].features) + self.test_template.clone_properties(self.app.domains[self.template]) self.loop.run_until_complete( self.test_template.clone_disk_files(self.app.domains[self.template])) From 804aa5a587227ce882c82ca4ff3f2be408bb7ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 17 Dec 2022 00:15:32 +0100 Subject: [PATCH 2/2] tests/backup: compare property value only if non-default 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. --- qubes/tests/integ/backup.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/qubes/tests/integ/backup.py b/qubes/tests/integ/backup.py index 0b597b55b..42b40f02c 100644 --- a/qubes/tests/integ/backup.py +++ b/qubes/tests/integ/backup.py @@ -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