Giuseppe Vallarelli has posted comments on this change.
Change subject: tests: Adding functional tests for networking
......................................................................
Patch Set 12: (5 inline comments)
....................................................
File tests/functional/networkTests.py
Line 70: opts={'bridged':
bridged})
Line 71: self.assertEqual(status, neterrors.ERR_BAD_BONDING, msg)
Line 72:
Line 73: def testFailWithInvalidBridgeName(self):
Line 74: invalid_bridge_names = ('a' * 16, 'a b', 'a\tb', 'a.b', 'a:b')
Mark, I'm fine with dropping some tests of those feel free to propose which
ones.
Line 75: for bridge_name in invalid_bridge_names:
Line 76: status, msg = self.vdsm_net.addNetwork(bridge_name)
Line 77: self.assertEqual(status, neterrors.ERR_BAD_BRIDGE, msg)
Line 78:
....................................................
File tests/functional/utils.py
Line 42: )
Line 43:
Line 44:
Line 45: @contextmanager
Line 46: def dummyIf():
That has been my first thinking but I didn't want to conflict with possible
dummy interfaces (dummy0..dummyN) in possible use by the host. I tried to make
as few assumptions as possible.
Line 47: """
Line 48: Manages a dummy interface resource, which is created with
Line 49: a pseudo-random name (e.g. dummy_85). A fixed number of
Line 50: attempts are done to create the required dummy interface.
Line 54: dummy_name = None
Line 55: attempts = 0
Line 56: try:
Line 57: while rc != SUCCESS and attempts < 100:
Line 58: dummy_name = 'dummy_%s' % randrange(0, 100)
I used that convention just in case on the host different dummy interfaces are
used. Which are usually identified with the convention you're pointing out.
Line 59: ip_add_dummy = [ip.cmd, 'link', 'add', dummy_name,
Line 60: 'type', 'dummy']
Line 61: rc, out, err = utils.execCmd(ip_add_dummy, sudo=True)
Line 62: attempts += 1
Line 77: def cleanupNet(func):
Line 78: """
Line 79: Restored a previously persisted network config
Line 80: in case of a test failure, traceback is kept.
Line 81: """
It may be useful in case of a test breaking for some reasons and having the
host running other tests running with a non conforming/clean environment. This
has been discussed previously.
Line 82:
Line 83: @wraps(func)
Line 84: def wrapper(*args, **kwargs):
Line 85: try:
....................................................
File tests/testValidation.py
Line 104: def RequireDummyMod(f):
Line 105: @wraps(f)
Line 106: def wrapper(*args, **kwargs):
Line 107: cmd_modprobe = [modprobe.cmd, "dummy"]
Line 108: if os.path.exists('/sys/modules/dummy'):
You're right, thanks!
Line 109: rc, out, err = utils.execCmd(cmd_modprobe, sudo=True)
Line 110: return f(*args, **kwargs)
Line 111: return wrapper
Line 112:
--
To view, visit http://gerrit.ovirt.org/14840
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic3be71db9dc0b92c443b87e22fe06f920055c4d3
Gerrit-PatchSet: 12
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: Livnat Peer <[email protected]>
Gerrit-Reviewer: Mark Wu <[email protected]>
Gerrit-Reviewer: Zhou Zheng Sheng <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches