Change in vdsm[master]: tests: v2v: add test for commit fb4c72a
nsoffer at redhat.com
nsoffer at redhat.com
Thu Oct 15 11:18:32 UTC 2015
Nir Soffer has posted comments on this change.
Change subject: tests: v2v: add test for commit fb4c72a
......................................................................
Patch Set 2:
(2 comments)
Suggested way to simplify the mock.
https://gerrit.ovirt.org/#/c/47364/2/tests/v2vTests.py
File tests/v2vTests.py:
Line 88:
Line 89: def storageVolLookupByPath(self, name):
Line 90: if self._storage_lookup_fail:
Line 91: e = fake.Error(libvirt.VIR_ERR_INTERNAL_ERROR)
Line 92: raise e
> raise fakeError(...)?
Introducing flags such as _storage_lookup_fail is more complicated then
needed. We can override this method in the specific test - see bellow.
Line 93: return LibvirtMock.Volume()
Line 94:
Line 95: class Volume(object):
Line 96: def info(self):
Line 212: if not v2v.supported():
Line 213: raise SkipTest('v2v is not supported current os version')
Line 214:
Line 215: def _connect(uri, username, passwd):
Line 216: return LibvirtMock(storage_lookup_fail=True)
We can do it in a simpler way:
connection = LibvirtMock()
def internal_error(name):
raise fake.Error(...)
connection.storageVolLookupByPath = internal_error
Line 217:
Line 218: with MonkeyPatchScope([(libvirtconnection, 'open_connection',
Line 219: _connect)]):
Line 220: vms = v2v.get_external_vms('esx://mydomain', 'user',
--
To view, visit https://gerrit.ovirt.org/47364
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iad523dc7c34276c6811513220cd7230ca5fc6e45
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list