Nir Soffer has uploaded a new change for review. Change subject: storageServer: Fix MountConnection.__eq__ ......................................................................
storageServer: Fix MountConnection.__eq__ The previous implementation was: - Using isinstance() instead of using self.__class__ - Was not using all object state, so objects with different state were considered as equal. This change fixes two broken tests. Change-Id: I5d1ace2cc2692f5da6c52ae9e88820d756043b06 Signed-off-by: Nir Soffer <[email protected]> --- M tests/storageServerTests.py M vdsm/storage/storageServer.py 2 files changed, 4 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/44292/1 diff --git a/tests/storageServerTests.py b/tests/storageServerTests.py index d4119f3..2df930b 100644 --- a/tests/storageServerTests.py +++ b/tests/storageServerTests.py @@ -74,7 +74,6 @@ c2 = MountConnection("spec", "vfstype", "options") self.assertTrue(c1 == c2, "%s should equal %s" % (c1, c2)) - @brokentest("__eq__ check isinstance instead fo class") def test_eq_subclass(self): class Subclass(MountConnection): pass @@ -82,7 +81,6 @@ c2 = Subclass("spec", "vfstype", "options") self.assertFalse(c1 == c2, "%s should not equal %s" % (c1, c2)) - @brokentest("__eq__ not using all object state") @permutations([ ("s1", "s2", "t", "t", "o", "o"), ("s", "s", "t1", "t2", "o", "o"), diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py index 95e1099..06c5eb1 100644 --- a/vdsm/storage/storageServer.py +++ b/vdsm/storage/storageServer.py @@ -253,10 +253,10 @@ raise def __eq__(self, other): - if not isinstance(other, MountConnection): - return False - - return self._mount.__eq__(other._mount) + return (self.__class__ == other.__class__ and + self._vfsType == other._vfsType and + self._remotePath == other._remotePath and + self._options == other._options) def getMountObj(self): return self._mount -- To view, visit https://gerrit.ovirt.org/44292 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5d1ace2cc2692f5da6c52ae9e88820d756043b06 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
