Change in vdsm[master]: tests: deduplicate clientIF fakes

fromani at redhat.com fromani at redhat.com
Wed Jan 14 13:09:00 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: tests: deduplicate clientIF fakes
......................................................................

tests: deduplicate clientIF fakes

both clientIFTests and vmfakelib modules
had an implementation of clientIF fake.

This patch reunite the two implementations
into one into vmfakelib.

Change-Id: I4b27c3d37f62a1e19bf252290fd6816f5c65adcc
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M tests/clientifTests.py
M tests/vmfakelib.py
2 files changed, 13 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/36893/1

diff --git a/tests/clientifTests.py b/tests/clientifTests.py
index 420f70e..50359d6 100644
--- a/tests/clientifTests.py
+++ b/tests/clientifTests.py
@@ -18,13 +18,14 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
-import logging
 import os.path
 from testlib import VdsmTestCase as TestCaseBase
 from testlib import temporaryPath
 from monkeypatch import MonkeyPatch
 from virt.vm import VolumeError
 import clientIF
+
+import vmfakelib as fake
 
 
 INEXISTENT_PATH = '/no/such/path'
@@ -49,13 +50,6 @@
     def mkFloppyFs(self, *args, **kwargs):
         self.calls.append(('mkFloppyFs', args, kwargs))
         return FAKE_FLOPPY_PATH
-
-
-class FakeClientIF(clientIF.clientIF):
-    def __init__(self):
-        # the bare minimum initialization for our test needs.
-        self.irs = None  # just to make sure nothing ever happens
-        self.log = logging.getLogger('ClientIFTests')
 
 
 def fakeDrive():
@@ -90,7 +84,7 @@
 class ClientIFTests(TestCaseBase):
 
     def setUp(self):
-        self.cif = FakeClientIF()
+        self.cif = fake.ClientIF()
 
     def assertCalled(self, funcName):
         sv = clientIF.supervdsm.getProxy()
diff --git a/tests/vmfakelib.py b/tests/vmfakelib.py
index 83c5b7a..36e4f8d 100644
--- a/tests/vmfakelib.py
+++ b/tests/vmfakelib.py
@@ -19,8 +19,10 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
-import xml.etree.ElementTree as etree
 from contextlib import contextmanager
+import logging
+import threading
+import xml.etree.ElementTree as etree
 
 import libvirt
 
@@ -28,6 +30,7 @@
 from vdsm import libvirtconnection
 
 import caps
+import clientIF
 from virt import vm
 
 from testlib import namedTemporaryDir
@@ -45,9 +48,13 @@
         return []
 
 
-class ClientIF(object):
-    def __init__(self, *args, **kwargs):
+class ClientIF(clientIF.clientIF):
+    def __init__(self):
+        # the bare minimum initialization for our test needs.
+        self.irs = None  # just to make sure nothing ever happens
+        self.log = logging.getLogger('ClientIFTests')
         self.channelListener = None
+        self.vmContainerLock = threading.Lock()
         self.vmContainer = {}
 
 


-- 
To view, visit http://gerrit.ovirt.org/36893
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b27c3d37f62a1e19bf252290fd6816f5c65adcc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list