Change in vdsm[master]: hooks: ovs: fix tests (waitForState and vdsProxy)

phoracek at redhat.com phoracek at redhat.com
Mon Jan 18 14:01:35 UTC 2016


Petr Horáček has uploaded a new change for review.

Change subject: hooks: ovs: fix tests (waitForState and vdsProxy)
......................................................................

hooks: ovs: fix tests (waitForState and vdsProxy)

We have to fake not only waitForKnownState, but also waitForState,
because of tests expects bond to turn UP, but that never happens.

We have to change proxy handling to match new behavior using
getProxy() function.

Change-Id: I50dc6cdf4312d194feeb2c8b7613a6adb61ccff9
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M tests/functional/networkTestsOVS.py
1 file changed, 21 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/52360/1

diff --git a/tests/functional/networkTestsOVS.py b/tests/functional/networkTestsOVS.py
index 17ffb3c..70b9d96 100644
--- a/tests/functional/networkTestsOVS.py
+++ b/tests/functional/networkTestsOVS.py
@@ -32,7 +32,7 @@
                           _get_source_route, dnsmasqDhcp, NETWORK_NAME,
                           IP_ADDRESS, IP_MASK, IP_CIDR, IP_GATEWAY,
                           IPv6_ADDRESS, IPv6_CIDR, VLAN_ID, NOCHK, SUCCESS)
-from utils import VdsProxy
+from utils import _VdsProxy
 import dhcp
 
 # WARNING: because of this module changes networkTests module, we cannot run
@@ -141,12 +141,13 @@
 
 
 # When we set OVS bond device up, it does not turn UP, but only UNKNOWN
-def _fakeWaitForKnownOperstate(*args, **kwargs):
+def _fakeWaitForOperstate(*args, **kwargs):
     pass
-networkTests._waitForKnownOperstate = _fakeWaitForKnownOperstate
+networkTests._waitForOperstate = _fakeWaitForOperstate
+networkTests._waitForKnownOperstate = _fakeWaitForOperstate
 
 
-class OVSVdsProxy(VdsProxy):
+class OVSVdsProxy(_VdsProxy):
 
     def setupNetworks(self, networks, bonds, options):
         if options.pop('ovs', True):
@@ -177,6 +178,21 @@
         return super(OVSVdsProxy, self).setupNetworks(networks, bonds, options)
 
 
+_instance = OVSVdsProxy()
+
+
+def getProxy():
+    """
+    We used to connect when a proxy was created but now
+    we want to connect only when the proxy is needed.
+    It is used in functional test context so we do not
+    care about concurrent calls of this function.
+    """
+    if not _instance._is_connected():
+        _instance._connect()
+    return _instance
+
+
 @expandPermutations
 class OVSNetworkTest(NetworkTest):
     __test__ = True
@@ -196,7 +212,7 @@
         return wrapper
 
     def setUp(self):
-        self.vdsm_net = OVSVdsProxy()
+        self.vdsm_net = getProxy()
 
     def setupNetworks(self, *args, **kwargs):
         # Do not run test_kernel_config


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50dc6cdf4312d194feeb2c8b7613a6adb61ccff9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>


More information about the vdsm-patches mailing list