Petr Horáček has uploaded a new change for review. Change subject: netinfoTests: test fake and hidden dummies, veths ......................................................................
netinfoTests: test fake and hidden dummies, veths New test adds dummies and veths with _fakeNics prefix and with non _fakeNics prefix and then verify if fake nics are shown in netinfo.nics() and the others are not. Change-Id: Ide618510b46eee28d939c32e8188bbd38349d660 Signed-off-by: Petr Horáček <[email protected]> --- M tests/netinfoTests.py 1 file changed, 21 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/31166/1 diff --git a/tests/netinfoTests.py b/tests/netinfoTests.py index 73bd56b..57a91f3 100644 --- a/tests/netinfoTests.py +++ b/tests/netinfoTests.py @@ -32,6 +32,7 @@ from vdsm.netinfo import (getBootProtocol, getDhclientIfaces, BONDING_MASTERS, BONDING_OPT, _randomIfaceName, _getBondingOptions) +from functional import dummy, veth from ipwrapperTests import _fakeTypeDetection from monkeypatch import MonkeyPatch, MonkeyPatchScope from testlib import VdsmTestCase as TestCaseBase, namedTemporaryDir @@ -160,6 +161,26 @@ self.assertEqual(set(netinfo.nics()), set(['em', 'me', 'fake', 'fake0'])) + @ValidateRunningAsRoot + def testFakeNics(self): + with MonkeyPatchScope([(ipwrapper.Link, '_fakeNics', ['veth_*', + 'dummy_*'])]): + d1 = dummy.create() + d2 = dummy.create(prefix='mehd_') + v1a, v1b = veth.create() + v2a, v2b = veth.create(prefix='mehv_') + + fakes = set([d1, v1a, v1b]) + hiddens = set([d2, v2a, v2b]) + nics = netinfo.nics() + dummy.remove(d1) + dummy.remove(d2) + veth.remove(v1a) + veth.remove(v2a) + + self.assertTrue(fakes.issubset(nics)) + self.assertFalse(hiddens.intersection(nics)) + def testGetBandwidthQos(self): notEmptyDoc = minidom.parseString("""<bandwidth> <inbound average='4500' burst='5400' /> -- To view, visit http://gerrit.ovirt.org/31166 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ide618510b46eee28d939c32e8188bbd38349d660 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Petr Horáček <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
