tests: rename domain when it is't defined libvirt

Regression test for QubesOS/qubes-issues#1632
This commit is contained in:
Marek Marczykowski-Górecki 2016-02-06 05:36:53 +01:00
parent 0b5bd060bb
commit f13abc2ace
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -32,6 +32,7 @@ import tempfile
import unittest
import time
from qubes.qubes import QubesVmCollection, QubesException, system_path
import libvirt
import qubes.qubes
import qubes.tests
@ -114,6 +115,14 @@ class TC_01_Properties(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
'/etc/systemd/system/multi-user.target.wants/'
'qubes-vm@{}.service'.format(self.vmname)))
def test_001_rename_libvirt_undefined(self):
self.vm.libvirt_domain.undefine()
self.vm._libvirt_domain = None
newname = self.make_vm_name('newname')
with self.assertNotRaises(libvirt.libvirtError):
self.vm.set_name(newname)
def test_010_netvm(self):
if self.qc.get_default_netvm() is None:
self.skip("Set default NetVM before running this test")