Change in vdsm[master]: Skipping networkTests if alien bonds presents in the system

iliam at redhat.com iliam at redhat.com
Tue Mar 22 09:25:47 UTC 2016


Ilia Meerovich has uploaded a new change for review.

Change subject: Skipping networkTests if alien bonds presents in the system
......................................................................

Skipping networkTests if alien bonds presents in the system

Alien bonds causes to tests to report incorrect results.
Testing with alien bonds doesnt test vdsm networking.
It makes sense since ovirt host shouldn't be used for other
purposes.

Change-Id: I5326305fac74a43ca7cab259133e7a8861fa9261
Signed-off-by: Ilia Meerovich <iliam at redhat.com>
---
M tests/functional/networkTests.py
1 file changed, 26 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/53498/9

diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index 0d20c28..412343a 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -53,7 +53,6 @@
 from vdsm.commands import execCmd
 from vdsm.utils import CommandPath, RollbackContext, pgrep, running
 
-
 from hookValidation import ValidatesHook
 
 from modprobe import RequireDummyMod, RequireVethMod
@@ -100,8 +99,18 @@
 @ValidateRunningAsRoot
 @RequireDummyMod
 def setupModule():
-    """Persists network configuration."""
-    getProxy().save_config()
+    vds = getProxy()
+    running_config, kernel_config = _get_running_and_kernel_config(
+        vds.config)
+    if ((running_config['networks'] != kernel_config['networks']) or
+            (running_config['bonds'] != kernel_config['bonds'])):
+        raise SkipTest("Tested host is not clean (running vs kernel):\n"
+                       "networks: %r != %r\n"
+                       "bonds: %r != %r\n",
+                       running_config['networks'], kernel_config['networks'],
+                       running_config['bonds'], kernel_config['bonds'])
+
+    vds.save_config()
     for _ in range(DUMMY_POOL_SIZE):
         dummy = Dummy()
         dummy.create()
@@ -190,6 +199,18 @@
             test_method(*args, **kwargs)
         return wrapped_test_method
     return wrapper
+
+
+def _get_running_and_kernel_config(bare_running_config):
+    """:param config: vdsm configuration, could be retrieved from getProxy()
+    """
+    bare_kernel_config = kernelconfig.KernelConfig(
+        vdsm.netinfo.cache.CachingNetInfo())
+    normalized_running_config = kernelconfig.normalize(bare_running_config)
+    # Unify strings to unicode instances so differences are easier to
+    # understand. This won't be needed once we move to Python 3.
+    return normalized_running_config.as_unicode(),\
+        bare_kernel_config.as_unicode()
 
 
 @expandPermutations
@@ -393,15 +414,8 @@
         return status, msg
 
     def _assert_kernel_config_matches_running_config(self):
-        bare_kernel_config = kernelconfig.KernelConfig(
-            vdsm.netinfo.cache.CachingNetInfo())
-        bare_running_config = self.vdsm_net.config
-        normalized_running_config = kernelconfig.normalize(bare_running_config)
-        # Unify strings to unicode instances so differences are easier to
-        # understand. This won't be needed once we move to Python 3.
-        running_config = normalized_running_config.as_unicode()
-        kernel_config = bare_kernel_config.as_unicode()
-
+        running_config, kernel_config = _get_running_and_kernel_config(
+            self.vdsm_net.config)
         # Do not use KernelConfig.__eq__ to get a better exception if something
         # breaks.
         self.assertEqual(running_config['networks'], kernel_config['networks'])


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5326305fac74a43ca7cab259133e7a8861fa9261
Gerrit-PatchSet: 9
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ilia Meerovich <iliam at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Ilia Meerovich <iliam at redhat.com>
Gerrit-Reviewer: Yaniv Kaul <ykaul at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the vdsm-patches mailing list