def test_recoverAllDomains(self): vm_uuid = str(uuid.uuid4()) syslist = FakeSystemctlList((vm_uuid,)) with MonkeyPatchScope([(command, 'systemctl_list', syslist)]): with conttestlib.tmp_run_dir(): xf = xmlfile.XMLFile(vm_uuid) save_xml(xf, conttestlib.minimal_dom_xml(vm_uuid=vm_uuid)) recovered_doms = containers.recoveryAllDomains() self.assertEqual(len(recovered_doms), 1) self.assertEqual(recovered_doms[0].UUIDString(), vm_uuid)
def test_recoverAllDomains(self): vm_uuid = str(uuid.uuid4()) syslist = FakeSystemctlList((vm_uuid, )) with MonkeyPatchScope([(command, 'systemctl_list', syslist)]): with conttestlib.tmp_run_dir(): xf = xmlfile.XMLFile(vm_uuid) save_xml(xf, conttestlib.minimal_dom_xml(vm_uuid=vm_uuid)) recovered_doms = containers.recoveryAllDomains() self.assertEquals(len(recovered_doms), 1) self.assertEquals(recovered_doms[0].UUIDString(), vm_uuid)
def test_recoverAllDomains_with_exceptions(self): vm_uuids = [str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4())] syslist = FakeSystemctlList([str(uuid.uuid4())] + vm_uuids[1:]) with MonkeyPatchScope([(command, "systemctl_list", syslist)]): with conttestlib.tmp_run_dir(): for vm_uuid in vm_uuids: xf = xmlfile.XMLFile(vm_uuid) save_xml(xf, conttestlib.minimal_dom_xml(vm_uuid=vm_uuid)) recovered_doms = containers.recoveryAllDomains() recovered_uuids = set(vm_uuids[1:]) self.assertEquals(len(recovered_doms), len(recovered_uuids)) for dom in recovered_doms: self.assertIn(dom.UUIDString(), recovered_uuids)
def test_recoverAllDomains_with_exceptions(self): vm_uuids = [ str(uuid.uuid4()), str(uuid.uuid4()), str(uuid.uuid4()), ] syslist = FakeSystemctlList([str(uuid.uuid4())] + vm_uuids[1:]) with MonkeyPatchScope([(command, 'systemctl_list', syslist)]): with conttestlib.tmp_run_dir(): for vm_uuid in vm_uuids: xf = xmlfile.XMLFile(vm_uuid) save_xml(xf, conttestlib.minimal_dom_xml(vm_uuid=vm_uuid)) recovered_doms = containers.recoveryAllDomains() recovered_uuids = set(vm_uuids[1:]) self.assertEquals(len(recovered_doms), len(recovered_uuids)) for dom in recovered_doms: self.assertIn(dom.UUIDString(), recovered_uuids)