tests: do not reload qubes.xml

In core3 this isn't needed anymore (and unit tests already check if
that's really true).
This commit is contained in:
Marek Marczykowski-Górecki 2017-06-20 16:16:34 +02:00
parent ea5ca79133
commit 51a17ba749
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
9 changed files with 14 additions and 37 deletions

View File

@ -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()

View File

@ -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 = []

View File

@ -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 = []

View File

@ -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(

View File

@ -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")

View File

@ -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]

View File

@ -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):

View File

@ -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:

View File

@ -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