Change in vdsm[master]: Removing mocking of _start function and add extraCmd variabl...
ybronhei at redhat.com
ybronhei at redhat.com
Wed May 8 14:07:56 UTC 2013
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Removing mocking of _start function and add extraCmd variable to proxy
......................................................................
Removing mocking of _start function and add extraCmd variable to proxy
Instead of adding monkeyPatch only for adding PYTHONPATH before running
the command, setting self.extraCmd will append extra field to the
execution.
Change-Id: I790fb1366bcfd369bd6be1618c284f2a945c19ca
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M tests/superVdsmTests.py
M vdsm/supervdsm.py
2 files changed, 5 insertions(+), 21 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/14585/1
diff --git a/tests/superVdsmTests.py b/tests/superVdsmTests.py
index ba8c4ee..01a1db2 100644
--- a/tests/superVdsmTests.py
+++ b/tests/superVdsmTests.py
@@ -4,9 +4,6 @@
import tempfile
from vdsm import utils
import os
-import uuid
-from vdsm import constants
-from monkeypatch import MonkeyPatch
@utils.memoized
@@ -20,21 +17,6 @@
return pyPath
-def monkeyStart(self):
- self._authkey = str(uuid.uuid4())
- self._log.debug("Launching Super Vdsm")
-
- superVdsmCmd = [getNeededPythonPath(), constants.EXT_PYTHON,
- supervdsm.SUPERVDSM,
- self._authkey, str(os.getpid()),
- self.pidfile, self.timestamp, self.address,
- str(os.getuid())]
- p = utils.execCmd(superVdsmCmd, sync=False, sudo=True)
- p.wait(2)
- if p.returncode:
- utils.panic('executing supervdsm failed')
-
-
class TestSuperVdsm(TestCaseBase):
def setUp(self):
testValidation.checkSudo(['python', supervdsm.SUPERVDSM])
@@ -46,6 +28,7 @@
self.addfd, address = tempfile.mkstemp()
self._proxy.setIPCPaths(pidfile, timestamp, address)
+ self._proxy.extraCmd = getNeededPythonPath()
def tearDown(self):
supervdsm.extraPythonPathList = []
@@ -53,12 +36,10 @@
os.close(fd)
self._proxy.kill() # cleanning old temp files
- @MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart)
def testIsSuperUp(self):
self._proxy.ping() # this call initiate svdsm
self.assertTrue(self._proxy.isRunning())
- @MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart)
def testKillSuper(self):
self._proxy.ping()
self._proxy.kill()
@@ -66,7 +47,6 @@
self._proxy.ping() # Launching vdsm after kill
self.assertTrue(self._proxy.isRunning())
- @MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart)
def testNoPidFile(self):
self._proxy.ping() # svdsm is up
self.assertTrue(self._proxy.isRunning())
diff --git a/vdsm/supervdsm.py b/vdsm/supervdsm.py
index a4bf74f..749ed41 100644
--- a/vdsm/supervdsm.py
+++ b/vdsm/supervdsm.py
@@ -100,6 +100,7 @@
# Declaration of public variables that keep files' names that svdsm
# uses. We need to be able to change these variables so that running
# tests doesn't disturb and already running VDSM on the host.
+ self.extraCmd = None
self.setIPCPaths(PIDFILE, TIMESTAMP, ADDRESS)
def setIPCPaths(self, pidfile, timestamp, address):
@@ -128,6 +129,9 @@
self.pidfile, self.timestamp, self.address,
str(os.getuid())]
+ if self.extraCmd:
+ superVdsmCmd.insert(0, self.extraCmd)
+
p = utils.execCmd(superVdsmCmd, sync=False, sudo=True)
p.wait(2)
if p.returncode:
--
To view, visit http://gerrit.ovirt.org/14585
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I790fb1366bcfd369bd6be1618c284f2a945c19ca
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>
More information about the vdsm-patches
mailing list