You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/07/21 06:32:12 UTC
git commit: SLIDER-249. TestShell sometimes hangs on Jenkins
Repository: incubator-slider
Updated Branches:
refs/heads/develop b2f8354d6 -> 87de86667
SLIDER-249. TestShell sometimes hangs on Jenkins
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/87de8666
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/87de8666
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/87de8666
Branch: refs/heads/develop
Commit: 87de8666700909a93530777e0e812cbe3d531fc2
Parents: b2f8354
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Sun Jul 20 21:31:43 2014 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Sun Jul 20 21:31:43 2014 -0700
----------------------------------------------------------------------
.../package/files/jmemcached-1.0.0.tar | Bin 122880 -> 0 bytes
slider-agent/src/test/python/agent/TestShell.py | 29 +++++++++++++++----
2 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/87de8666/app-packages/memcached/package/files/jmemcached-1.0.0.tar
----------------------------------------------------------------------
diff --git a/app-packages/memcached/package/files/jmemcached-1.0.0.tar b/app-packages/memcached/package/files/jmemcached-1.0.0.tar
deleted file mode 100644
index a29de79..0000000
Binary files a/app-packages/memcached/package/files/jmemcached-1.0.0.tar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/87de8666/slider-agent/src/test/python/agent/TestShell.py
----------------------------------------------------------------------
diff --git a/slider-agent/src/test/python/agent/TestShell.py b/slider-agent/src/test/python/agent/TestShell.py
index 32a8d11..8ef72b3 100644
--- a/slider-agent/src/test/python/agent/TestShell.py
+++ b/slider-agent/src/test/python/agent/TestShell.py
@@ -26,9 +26,21 @@ from mock.mock import patch, MagicMock, call
from agent import shell
from sys import platform as _platform
import subprocess, time
+import sys
+import platform
class TestShell(unittest.TestCase):
+ unsupported_for_test = []
+ def linux_distribution(self):
+ PYTHON_VER = sys.version_info[0] * 10 + sys.version_info[1]
+
+ if PYTHON_VER < 26:
+ linux_dist = platform.dist()
+ else:
+ linux_dist = platform.linux_distribution()
+
+ return linux_dist
@patch("os.setuid")
def test_changeUid(self, os_setUIDMock):
@@ -38,24 +50,29 @@ class TestShell(unittest.TestCase):
def test_kill_process_with_children(self):
+ dist = self.linux_distribution()
+ operatingSystem = dist[0].lower()
+ if operatingSystem in self.unsupported_for_test:
+ return
+
if _platform == "linux" or _platform == "linux2": # Test is Linux-specific
gracefull_kill_delay_old = shell.gracefull_kill_delay
shell.gracefull_kill_delay = 0.1
- sleep_cmd = "sleep 314159265"
- test_cmd = """ (({0}) | ({0} | {0})) """.format(sleep_cmd)
+ sleep_cmd = "sleep 10"
+ test_cmd = """ (({0}) & ({0} & {0})) """.format(sleep_cmd)
# Starting process tree (multiple process groups)
- test_process = subprocess.Popen(test_cmd, shell=True)
+ test_process = subprocess.Popen(test_cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
time.sleep(0.3) # Delay to allow subprocess to start
# Check if processes are running
- ps_cmd = """ps aux | grep "{0}" | grep -v grep """.format(sleep_cmd)
- ps_process = subprocess.Popen(ps_cmd, stdout=subprocess.PIPE, shell=True)
+ ps_cmd = """ps aux """
+ ps_process = subprocess.Popen(ps_cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
(out, err) = ps_process.communicate()
self.assertTrue(sleep_cmd in out)
# Kill test process
shell.kill_process_with_children(test_process.pid)
test_process.communicate()
# Now test process should not be running
- ps_process = subprocess.Popen(ps_cmd, stdout=subprocess.PIPE, shell=True)
+ ps_process = subprocess.Popen(ps_cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
(out, err) = ps_process.communicate()
self.assertFalse(sleep_cmd in out)
shell.gracefull_kill_delay = gracefull_kill_delay_old