Yaniv Bronhaim has uploaded a new change for review.
Change subject: Supervdsm tests: Fail tests When supervdsm does not start as expected
......................................................................
Supervdsm tests: Fail tests When supervdsm does not start as expected
Checking return value of execCmd when starting supervdsm process. If
errorcode returns, the ut will return as failed.
Change-Id: I33a5564a8e67d70087fef83ae651e8729bdb59a5
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M tests/superVdsmTests.py
1 file changed, 14 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/13878/1
diff --git a/tests/superVdsmTests.py b/tests/superVdsmTests.py
index f03a2b7..0a79329 100644
--- a/tests/superVdsmTests.py
+++ b/tests/superVdsmTests.py
@@ -8,7 +8,6 @@
from vdsm import constants
from storage import misc
from monkeypatch import MonkeyPatch
-from time import sleep
@utils.memoized
@@ -31,8 +30,10 @@
self._authkey, str(os.getpid()),
self.pidfile, self.timestamp, self.address,
str(os.getuid())]
- misc.execCmd(superVdsmCmd, sync=False, sudo=True)
- sleep(2)
+ p = misc.execCmd(superVdsmCmd, sync=False, sudo=True)
+ p.wait(3)
+ if p.returncode:
+ raise ("supervdsm is corrupted, executing supervdsmCmd failed")
class TestSuperVdsm(TestCaseBase):
@@ -53,14 +54,21 @@
os.close(fd)
self._proxy.kill() # cleanning old temp files
+ def pingStart(self):
+ try:
+ return self._proxy.ping() # this call initiate svdsm
+ except:
+ # starting svdsm raises exception
+ return False
+
@MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart)
def testIsSuperUp(self):
- self._proxy.ping() # this call initiate svdsm
+ self.assertTrue(self.pingStart())
self.assertTrue(self._proxy.isRunning())
@MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart)
def testKillSuper(self):
- self._proxy.ping()
+ self.assertTrue(self.pingStart())
self._proxy.kill()
self.assertFalse(self._proxy.isRunning())
self._proxy.ping() # Launching vdsm after kill
@@ -68,7 +76,7 @@
@MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart)
def testNoPidFile(self):
- self._proxy.ping() # svdsm is up
+ self.assertTrue(self.pingStart())
self.assertTrue(self._proxy.isRunning())
utils.rmFile(self._proxy.timestamp)
self.assertRaises(IOError, self._proxy.isRunning)
--
To view, visit
http://gerrit.ovirt.org/13878
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I33a5564a8e67d70087fef83ae651e8729bdb59a5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>