Francesco Romani has posted comments on this change. Change subject: vdsm: add tests for hostdev mapper ......................................................................
Patch Set 1: (5 comments) some comments inside about possibile improvements, but this looks like a good start to me. http://gerrit.ovirt.org/#/c/31766/1/tests/hostdevTests.py File tests/hostdevTests.py: Line 25: from vdsm import libvirtconnection Line 26: from monkeypatch import MonkeyPatch Line 27: Line 28: Line 29: class ifMock(object): Please be more PEP8 friendly, classes should have a CamelCase name. Moreover, is this a Mock or a Fake? http://martinfowler.com/articles/mocksArentStubs.html (it is a mistake I often do myself, so I try to be cautious here) Line 30: Line 31: def __init__(self): Line 32: self.vmContainer = {} Line 33: Line 31: def __init__(self): Line 32: self.vmContainer = {} Line 33: Line 34: Line 35: class virNodeDevice(object): same - unless you're mocking an existing class, in that case please document that in the docstring Line 36: Line 37: def __init__(self, xml): Line 38: self.xml = xml Line 39: self._name = parseString(self.XMLDesc(0)).\ Line 47: Line 48: # unfortunately, in real environment these are the most problematic calls Line 49: # but in order to test them, we would put host in danger of removing Line 50: # device needed to run properly (such as nic) Line 51: def dettach(self): maybe deAttach? or detach? Line 52: pass Line 53: Line 54: def reAttach(self): Line 55: pass Line 54: def reAttach(self): Line 55: pass Line 56: Line 57: Line 58: class ConnectionMock: same comment about Mock vs Fake Line 59: Line 60: PCI_DEVICE_XML = [""" Line 61: <device> Line 62: <name>pci_0000_00_1a_0</name> Line 279: """ Line 280: mapper = hostdev.HostDeviceMapper(self.cif, self.log) Line 281: Line 282: for device in libvirtconnection.get()._devices: Line 283: self.assertTrue(device.name() in mapper._map) assertIn() is backported, we can make use of it -- To view, visit http://gerrit.ovirt.org/31766 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I15ba986c77ec710f6becd0244e86d27ec2023e27 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Polednik <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Michal Skrivanek <[email protected]> Gerrit-Reviewer: Vinzenz Feenstra <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
