Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-13 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 6:

(1 comment)

https://gerrit.ovirt.org/#/c/65327/6/tests/utilsTests.py
File tests/utilsTests.py:

Line 102: self.proc.terminate()
Line 103: wait_for_zombie(self.proc, 1)
Line 104: 
Line 105: def fail():
Line 106: raise RuntimeError("Attempt to kill a zombie process")
> In patch #65328 we use RuntimeError as well. We mentioned in commit message
Yes, but with different error text - this should make debugging the tests 
easier in case of errors.

We can do something like this:

def fail(exception, msg):
raise exception(msg)

And then n each test we can do:

self.proc.kill = partial(fail, RuntimeError,
"Attempt to kill a zombie process")

But I find this much harder to understand compared to:

def fail():
raise RuntimeError("Attempt to kill a zombie process")
   
self.proc.kill = fail

The best would be to use lambda:

   self.proc.kill = lambda: raise RuntimeError("Attempt to kill a zombie 
process")

But lambda does not support this syntax.
Line 107: 
Line 108: self.proc.kill = fail
Line 109: with utils.terminating(self.proc):
Line 110: pass


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-13 Thread piotr . kliczewski
Piotr Kliczewski has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 6:

(1 comment)

https://gerrit.ovirt.org/#/c/65327/6/tests/utilsTests.py
File tests/utilsTests.py:

Line 102: self.proc.terminate()
Line 103: wait_for_zombie(self.proc, 1)
Line 104: 
Line 105: def fail():
Line 106: raise RuntimeError("Attempt to kill a zombie process")
> This raises rumtime error and will fail the test if raised.
In patch #65328 we use RuntimeError as well. We mentioned in commit message 
reuse of this method so let's do it.
Line 107: 
Line 108: self.proc.kill = fail
Line 109: with utils.terminating(self.proc):
Line 110: pass


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-13 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 7:

* Update Tracker::IGNORE, not relevant for branch: master
* Check Bug-Url::IGNORE, not relevant for branch: master
* Check Public Bug::WARN, no public bug url found
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-4.0'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-13 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 6:

(1 comment)

https://gerrit.ovirt.org/#/c/65327/6/tests/utilsTests.py
File tests/utilsTests.py:

Line 102: self.proc.terminate()
Line 103: wait_for_zombie(self.proc, 1)
Line 104: 
Line 105: def fail():
Line 106: raise RuntimeError("Attempt to kill a zombie process")
> in previous patch I though we wanted to reuse similar code but now I see th
This raises rumtime error and will fail the test if raised.

The other fail helper raise expected error and the test will fail if not raised.

Please see the next patches for the complete picture.
Line 107: 
Line 108: self.proc.kill = fail
Line 109: with utils.terminating(self.proc):
Line 110: pass


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-13 Thread piotr . kliczewski
Piotr Kliczewski has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 6: Code-Review-1

(1 comment)

https://gerrit.ovirt.org/#/c/65327/6/tests/utilsTests.py
File tests/utilsTests.py:

PS6, Line 105: def fail():
 : raise RuntimeError("Attempt to kill a zombie 
process")
in previous patch I though we wanted to reuse similar code but now I see that 
we copied and pasted it here.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-12 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 6: Verified+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-12 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 6:

This version removes the now unneeded re module.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-12 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 6:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-4.0'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-12 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 5: Verified+1

This version simplifies the helpers for detecting a zombie.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-12 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 5:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-4.0'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-10 Thread fromani
Francesco Romani has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 4: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-10 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 4: Continuous-Integration+1

Verfied on travis:
https://travis-ci.org/nirs/vdsm/builds/166549485

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-10 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 4:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-4.0'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-10 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 3:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-4.0'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-10 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 2:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-4.0'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-10 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 1: Verified+1

Verified by the tests.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-10 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Add tests for waiting on a zombie process
..


Patch Set 1:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-4.0'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: tests: Add tests for waiting on a zombie process

2016-10-10 Thread nsoffer
Nir Soffer has uploaded a new change for review.

Change subject: tests: Add tests for waiting on a zombie process
..

tests: Add tests for waiting on a zombie process

If a process was terminated but not waited, terminating context manager
should wait for the process.  Add a test and a helper for waiting until
process becomes a zombie.

Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Signed-off-by: Nir Soffer 
---
M tests/utilsTests.py
1 file changed, 35 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/65327/1

diff --git a/tests/utilsTests.py b/tests/utilsTests.py
index eabd459..27a84e7 100644
--- a/tests/utilsTests.py
+++ b/tests/utilsTests.py
@@ -30,6 +30,7 @@
 import operator
 import os
 import os.path
+import re
 import select
 import signal
 import tempfile
@@ -98,6 +99,18 @@
 self.assertIsNone(self.proc.poll())
 self.assertEqual(self.proc.returncode, -signal.SIGKILL)
 
+def test_process_zombie(self):
+self.proc.terminate()
+wait_for_zombie(self.proc, 1)
+
+def fail():
+raise RuntimeError("Attempt to kill a zombie process")
+
+self.proc.kill = fail
+with utils.terminating(self.proc):
+pass
+self.assertEqual(self.proc.returncode, -signal.SIGTERM)
+
 def test_kill_failure(self):
 class FakeKillError(Exception):
 pass
@@ -115,6 +128,28 @@
 self.assertIsNone(self.proc.returncode)
 
 
+_is_zombie = re.compile(r"^State:\s*Z\s*\(zombie\)$", re.MULTILINE).search
+
+
+def wait_for_zombie(proc, timeout, interval=0.1):
+interval = min(interval, timeout)
+deadline = utils.monotonic_time() + timeout
+proc_status = "/proc/%d/status" % proc.pid
+while True:
+time.sleep(interval)
+try:
+with open(proc_status) as f:
+data = f.read()
+except EnvironmentError as e:
+if e.errno != errno.ENOENT:
+raise
+raise RuntimeError("Process does not exists")
+if _is_zombie(data):
+return
+if utils.monotonic_time() > deadline:
+raise RuntimeError("Timeout waiting for process")
+
+
 class RetryTests(TestCaseBase):
 def testStopCallback(self):
 counter = [0]


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I238d77213153b1fa98bb3f52b33a6fd78bb57bca
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org