Assaf Muller has posted comments on this change.
Change subject: Functional Tests [2/3]: Added ipwrapper.ruleExists+routeExists ......................................................................
Patch Set 3: -Verified
(6 comments)
.................................................... File lib/vdsm/ipwrapper.py Line 105: def __iter__(self): Line 106: for word in str(self).split(): Line 107: yield word Line 108: Line 109: def __eq__(self, other): Done Line 110: return self.__dict__ == other.__dict__ Line 111: Line 112: def __ne__(self, other): Line 113: return not self.__eq__(other)
Line 251: command += route Line 252: _execCmd(command) Line 253: Line 254: Line 255: def _getValidEntries(ofType, outOf): Done Line 256: for entry in outOf: Line 257: try: Line 258: yield ofType.fromText(entry) Line 259: except ValueError:
Line 260: pass Line 261: Line 262: Line 263: def routeExists(route): Line 264: return route in _getValidEntries(ofType=Route, Done Line 265: outOf=routeShowTable('all')) Line 266: Line 267: Line 268: def ruleList():
.................................................... File tests/functional/networkTests.py Line 410: @RequireDummyMod Line 411: @ValidateRunningAsRoot Line 412: def testRuleExists(self): Line 413: with dummyIf(1) as nics: Line 414: nic = nics[0] Alright, but once all the rest of the functional tests are in I want to create a Dummy class. It will implement all the current stuff in dummy.py + __enter__ and __exit__ so in these tests that currently go: "with dummyIf(1) as nics:" It'd instead go: "with Dummy() as nic:" Line 415: dummy.setIP(nic, IP_ADDRESS, IP_CIDR) Line 416: dummy.setLinkUp(nic) Line 417: Line 418: rules = [Rule(source=IP_NETWORK_AND_CIDR, table=IP_TABLE),
Line 428: @RequireDummyMod Line 429: @ValidateRunningAsRoot Line 430: def testRouteExists(self): Line 431: with dummyIf(1) as nics: Line 432: nic = nics[0] Done Line 433: dummy.setIP(nic, IP_ADDRESS, IP_CIDR) Line 434: dummy.setLinkUp(nic) Line 435: Line 436: routes = [Route(network='0.0.0.0/0', ipaddr=IP_GATEWAY,
.................................................... File tests/functional/utils.py Line 79: raise Line 80: return wrapper Line 81: Line 82: Line 83: def saveRules(): The idea is to wrap a single line in a function to replace a comment, but this isn't important enough to argue about. Line 84: return ipwrapper.ruleList() Line 85: Line 86: Line 87: def restoreRules(base):