Change in vdsm[ovirt-3.5]: automation: Disable tests requiring tun device

fromani at redhat.com fromani at redhat.com
Mon Oct 26 12:24:56 UTC 2015


Hello Ido Barkan, David Caro, Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/47731

to review the following change.

Change subject: automation: Disable tests requiring tun device
......................................................................

automation: Disable tests requiring tun device

In commit a9e9e7bcc7a1 (tests: temporarily exclude few tests to restore
CI) we disabled too many networking tests, including unrelated test
from utilsTests.py that happen to have the same name.

This patch adds @require_tun decorator to disable tests needing the tun
device.

Other tests seems to run fine in the CI, giving them another chance.

Change-Id: I3be2fe5774ec7f964416e02f809f44263e7d5644
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/46641
Continuous-Integration: Jenkins CI
Reviewed-by: Ido Barkan <ibarkan at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-by: David Caro <dcaroest at redhat.com>
---
M tests/tcTests.py
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/47731/1

diff --git a/tests/tcTests.py b/tests/tcTests.py
index f84ca90..ceeb2e7 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -20,6 +20,7 @@
 #
 
 import random
+import functools
 import time
 import string
 import os
@@ -42,6 +43,15 @@
 import platform
 
 EXT_IP = "/sbin/ip"
+
+
+def requires_tun(f):
+    @functools.wraps(f)
+    def wrapper(*a, **kw):
+        if not os.path.exists("/dev/net/tun"):
+            raise SkipTest("This test requires tun device")
+        return f(*a, **kw)
+    return wrapper
 
 
 class _Interface():
@@ -248,6 +258,7 @@
     _bridge2 = _Bridge('target2-')
 
     @ValidateRunningAsRoot
+    @requires_tun
     def setUp(self):
         _checkDependencies()
         self._tap0.addDevice()


-- 
To view, visit https://gerrit.ovirt.org/47731
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3be2fe5774ec7f964416e02f809f44263e7d5644
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: David Caro <dcaroest at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list