From 51a17ba749d0837ef748488f724e5ea3b6261999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 20 Jun 2017 16:16:34 +0200 Subject: [PATCH] tests: do not reload qubes.xml In core3 this isn't needed anymore (and unit tests already check if that's really true). --- qubes/tests/__init__.py | 7 ------- qubes/tests/extra.py | 2 +- qubes/tests/integ/backup.py | 6 ------ qubes/tests/integ/basic.py | 19 ++++++------------- qubes/tests/integ/dispvm.py | 3 --- qubes/tests/integ/network.py | 2 +- qubes/tests/integ/vm_qrexec_gui.py | 2 +- tests/block.py | 2 +- tests/pvgrub.py | 8 ++++---- 9 files changed, 14 insertions(+), 37 deletions(-) diff --git a/qubes/tests/__init__.py b/qubes/tests/__init__.py index 472ce361..afe25c7a 100644 --- a/qubes/tests/__init__.py +++ b/qubes/tests/__init__.py @@ -641,13 +641,6 @@ class SystemTestsMixin(object): self.pool = self.app.add_pool(**POOL_CONF) self.created_pool = True - def reload_db(self): - self.app = qubes.Qubes(qubes.tests.XMLPATH) - - def save_and_reload_db(self): - self.app.save() - self.reload_db() - def tearDown(self): self.remove_test_vms() diff --git a/qubes/tests/extra.py b/qubes/tests/extra.py index 5b9a2d6d..b89574aa 100644 --- a/qubes/tests/extra.py +++ b/qubes/tests/extra.py @@ -52,7 +52,7 @@ class ExtraTestCase(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): template=template, label='red') vm.create_on_disk() - self.save_and_reload_db() + self.app.save() # get objects after reload vms = [] diff --git a/qubes/tests/integ/backup.py b/qubes/tests/integ/backup.py index 7dec4add..c424fe87 100644 --- a/qubes/tests/integ/backup.py +++ b/qubes/tests/integ/backup.py @@ -171,9 +171,6 @@ class BackupTestsMixin(qubes.tests.SystemTestsMixin): else: raise - # FIXME why? - #self.reload_db() - def restore_backup(self, source=None, appvm=None, options=None, expect_errors=None, manipulate_restore_info=None, passphrase='qubes'): @@ -197,9 +194,6 @@ class BackupTestsMixin(qubes.tests.SystemTestsMixin): with self.assertNotRaises(qubes.exc.QubesException): restore_op.restore_do(restore_info) - # maybe someone forgot to call .save() - self.reload_db() - errors = [] if expect_errors is None: expect_errors = [] diff --git a/qubes/tests/integ/basic.py b/qubes/tests/integ/basic.py index dbf7ecf4..ebf9f6d4 100644 --- a/qubes/tests/integ/basic.py +++ b/qubes/tests/integ/basic.py @@ -77,13 +77,6 @@ class TC_01_Properties(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): label='red') self.loop.run_until_complete(self.vm.create_on_disk()) - def save_and_reload_db(self): - super(TC_01_Properties, self).save_and_reload_db() - if hasattr(self, 'vm'): - self.vm = self.app.domains[self.vm.qid] - if hasattr(self, 'netvm'): - self.netvm = self.app.domains[self.netvm.qid] - @unittest.expectedFailure def test_000_rename(self): newname = self.make_vm_name('newname') @@ -167,7 +160,7 @@ class TC_01_Properties(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): self.assertIn('source', testvm2.volumes['root'].config) # qubes.xml reload - self.save_and_reload_db() + self.app.save() testvm1 = self.app.domains[testvm1.qid] testvm2 = self.app.domains[testvm2.qid] @@ -210,7 +203,7 @@ class TC_01_Properties(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): self.loop.run_until_complete(testvm3.clone_disk_files(testvm1)) # qubes.xml reload - self.save_and_reload_db() + self.app.save() testvm1 = self.app.domains[testvm1.qid] testvm3 = self.app.domains[testvm3.qid] @@ -274,7 +267,7 @@ class TC_02_QvmPrefs(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): name=self.make_vm_name("vm"), label='red') self.loop.run_until_complete(self.testvm.create_on_disk()) - self.save_and_reload_db() + self.app.save() def setup_hvm(self): self.testvm = self.app.add_new_vm( @@ -283,7 +276,7 @@ class TC_02_QvmPrefs(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): label='red') self.testvm.hvm = True self.loop.run_until_complete(self.testvm.create_on_disk()) - self.save_and_reload_db() + self.app.save() def pref_set(self, name, value, valid=True): p = subprocess.Popen( @@ -388,7 +381,7 @@ class TC_03_QvmRevertTemplateChanges(qubes.tests.SystemTestsMixin, self.test_template.clone_properties(self.app.default_template) self.loop.run_until_complete( self.test_template.clone_disk_files(self.app.default_template)) - self.save_and_reload_db() + self.app.save() def setup_hvm_template(self): self.test_template = self.app.add_new_vm( @@ -398,7 +391,7 @@ class TC_03_QvmRevertTemplateChanges(qubes.tests.SystemTestsMixin, hvm=True ) self.loop.run_until_complete(self.test_template.create_on_disk()) - self.save_and_reload_db() + self.app.save() def get_rootimg_checksum(self): p = subprocess.Popen( diff --git a/qubes/tests/integ/dispvm.py b/qubes/tests/integ/dispvm.py index 2d6da892..2642cd27 100644 --- a/qubes/tests/integ/dispvm.py +++ b/qubes/tests/integ/dispvm.py @@ -59,7 +59,6 @@ class TC_04_DispVM(qubes.tests.SystemTestsMixin, dispvm_name = lines[1] # wait for actual DispVM destruction time.sleep(1) - self.reload_db() self.assertNotIn(dispvm_name, self.app.domains) @unittest.expectedFailure @@ -90,7 +89,6 @@ class TC_04_DispVM(qubes.tests.SystemTestsMixin, dispvm_name = lines[0] self.assertNotEquals(dispvm_name, b"ERROR") - self.reload_db() self.assertNotIn(dispvm_name, self.app.domains) class TC_20_DispVMMixin(qubes.tests.SystemTestsMixin): @@ -146,7 +144,6 @@ class TC_20_DispVMMixin(qubes.tests.SystemTestsMixin): finally: dispvm.cleanup() - self.reload_db() self.assertNotIn(dispvm.name, self.app.domains, "DispVM not removed from qubes.xml") diff --git a/qubes/tests/integ/network.py b/qubes/tests/integ/network.py index e1fb075b..eee9354d 100644 --- a/qubes/tests/integ/network.py +++ b/qubes/tests/integ/network.py @@ -763,7 +763,7 @@ class VmUpdatesMixin(qubes.tests.SystemTestsMixin): self.loop.run_until_complete(self.testvm1.create_on_disk()) def test_000_simple_update(self): - self.save_and_reload_db() + self.app.save() # reload the VM to have all the properties properly set (especially # default netvm) self.testvm1 = self.app.domains[self.testvm1.qid] diff --git a/qubes/tests/integ/vm_qrexec_gui.py b/qubes/tests/integ/vm_qrexec_gui.py index 219e2cf9..b9b3f807 100644 --- a/qubes/tests/integ/vm_qrexec_gui.py +++ b/qubes/tests/integ/vm_qrexec_gui.py @@ -963,7 +963,7 @@ class TC_10_Generic(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): label='red', template=self.app.default_template) self.loop.run_until_complete(self.vm.create_on_disk()) - self.save_and_reload_db() + self.app.save() self.vm = self.app.domains[self.vm.qid] def test_000_anyvm_deny_dom0(self): diff --git a/tests/block.py b/tests/block.py index 3d9dcbac..42b1edd3 100644 --- a/tests/block.py +++ b/tests/block.py @@ -39,7 +39,7 @@ class TC_00_List(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): name=self.make_vm_name("vm"), template=self.qc.get_vm_by_name(self.template)) self.vm.create_on_disk(verbose=False) - self.save_and_reload_db() + self.app.save() self.qc.unlock_db() self.vm.start() else: diff --git a/tests/pvgrub.py b/tests/pvgrub.py index 9dcc27be..9e4686af 100644 --- a/tests/pvgrub.py +++ b/tests/pvgrub.py @@ -87,7 +87,7 @@ class TC_40_PVGrub(qubes.tests.SystemTestsMixin): testvm1.create_on_disk(verbose=False, source_template=self.qc.get_vm_by_name( self.template)) - self.save_and_reload_db() + self.app.save() self.qc.unlock_db() testvm1 = self.qc[testvm1.qid] testvm1.start() @@ -99,7 +99,7 @@ class TC_40_PVGrub(qubes.tests.SystemTestsMixin): self.qc.load() testvm1 = self.qc[testvm1.qid] testvm1.kernel = 'pvgrub2' - self.save_and_reload_db() + self.app.save() self.qc.unlock_db() testvm1 = self.qc[testvm1.qid] testvm1.start() @@ -121,7 +121,7 @@ class TC_40_PVGrub(qubes.tests.SystemTestsMixin): name=self.make_vm_name('vm1')) testvm1.create_on_disk(verbose=False, source_template=test_template) - self.save_and_reload_db() + self.app.save() self.qc.unlock_db() test_template = self.qc[test_template.qid] testvm1 = self.qc[testvm1.qid] @@ -136,7 +136,7 @@ class TC_40_PVGrub(qubes.tests.SystemTestsMixin): test_template.kernel = 'pvgrub2' testvm1 = self.qc[testvm1.qid] testvm1.kernel = 'pvgrub2' - self.save_and_reload_db() + self.app.save() self.qc.unlock_db() # Check if TemplateBasedVM boots and has the right kernel