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/11/10 00:46:53 UTC
[1/3] incubator-slider git commit: SLIDER-630. slider-agent unit
tests fail on debian and suse and windows
Repository: incubator-slider
Updated Branches:
refs/heads/releases/slider-0.60 d6299b746 -> a036ec112
SLIDER-630. slider-agent unit tests fail on debian and suse and windows
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/16a48dff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/16a48dff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/16a48dff
Branch: refs/heads/releases/slider-0.60
Commit: 16a48dff95ce044ba98d2ffdf7b2081a45f45237
Parents: d6299b7
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Sun Nov 9 14:26:54 2014 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Sun Nov 9 15:07:00 2014 -0800
----------------------------------------------------------------------
slider-agent/src/test/python/python-wrap | 13 +++++----
.../resource_management/TestExecuteResource.py | 2 +-
slider-agent/src/test/python/unitTests.py | 2 +-
slider-assembly/pom.xml | 28 ++++++++++++++++++--
slider-assembly/src/test/python/unitTests.py | 2 +-
5 files changed, 37 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/16a48dff/slider-agent/src/test/python/python-wrap
----------------------------------------------------------------------
diff --git a/slider-agent/src/test/python/python-wrap b/slider-agent/src/test/python/python-wrap
index ea57721..88a8c55 100755
--- a/slider-agent/src/test/python/python-wrap
+++ b/slider-agent/src/test/python/python-wrap
@@ -17,23 +17,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-export PYTHONPATH=/usr/lib/python2.6/site-packages:$PYTHONPATH
-
# reset settings
unset PYTHON
+if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
+ PYTHON=/usr/bin/python2.6
+fi
+
# checking for preferable python versions
if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
PYTHON=/usr/bin/python2.7
fi
-if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
- PYTHON=/usr/bin/python2.6
+# if no preferable python versions found, try to use system one
+if [ -a /usr/bin/python ] && [ -z "$PYTHON" ]; then
+ PYTHON=/usr/bin/python
fi
# if no preferable python versions found, try to use system one
if [[ -z "$PYTHON" ]]; then
- PYTHON=/usr/bin/python
+ PYTHON=python
fi
# execute script
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/16a48dff/slider-agent/src/test/python/resource_management/TestExecuteResource.py
----------------------------------------------------------------------
diff --git a/slider-agent/src/test/python/resource_management/TestExecuteResource.py b/slider-agent/src/test/python/resource_management/TestExecuteResource.py
index f7f6371..0673b66 100644
--- a/slider-agent/src/test/python/resource_management/TestExecuteResource.py
+++ b/slider-agent/src/test/python/resource_management/TestExecuteResource.py
@@ -77,7 +77,7 @@ class TestExecuteResource(TestCase):
poll_after = 5)
self.assertTrue(False, "Should fail as process does not run for 5 seconds")
except Fail as e:
- self.assertTrue("returned 1" in e.message)
+ self.assertTrue("returned 1" in str(e))
pass
self.assertTrue(popen_mock.called, 'subprocess.Popen should have been called!')
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/16a48dff/slider-agent/src/test/python/unitTests.py
----------------------------------------------------------------------
diff --git a/slider-agent/src/test/python/unitTests.py b/slider-agent/src/test/python/unitTests.py
index 6aa0167..b65c075 100644
--- a/slider-agent/src/test/python/unitTests.py
+++ b/slider-agent/src/test/python/unitTests.py
@@ -32,7 +32,7 @@ ignoredDirs = ["mock"]
class TestAgent(unittest.TestSuite):
def run(self, result, debug=False):
run = unittest.TestSuite.run
- run(self, result, debug)
+ run(self, result)
return result
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/16a48dff/slider-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/slider-assembly/pom.xml b/slider-assembly/pom.xml
index fa6f1ad..b6f20c0 100644
--- a/slider-assembly/pom.xml
+++ b/slider-assembly/pom.xml
@@ -38,6 +38,9 @@
<src.confdir>src/conf-hdp</src.confdir>
<src.libdir>${project.build.directory}/lib</src.libdir>
<src.agent.ini.dir>${project.build.directory}/../../slider-agent/conf</src.agent.ini.dir>
+ <python.ver>python >= 2.6</python.ver>
+ <executable.python>${project.basedir}/../slider-agent/src/test/python/python-wrap</executable.python>
+ <python.path.l>${project.basedir}/src/main/scripts:${project.basedir}/../slider-agent/src/test/python/mock:${project.basedir}/src/test/python/scripts</python.path.l>
<skipTests>false</skipTests>
</properties>
@@ -72,13 +75,13 @@
<executions>
<execution>
<configuration>
- <executable>python</executable>
+ <executable>${executable.python}</executable>
<workingDirectory>src/test/python</workingDirectory>
<arguments>
<argument>unitTests.py</argument>
</arguments>
<environmentVariables>
- <PYTHONPATH>${project.basedir}/src/main/scripts:${project.basedir}/../slider-agent/src/test/python/mock:${project.basedir}/src/test/python/scripts</PYTHONPATH>
+ <PYTHONPATH>${python.path.l}</PYTHONPATH>
</environmentVariables>
<skip>${skipTests}</skip>
</configuration>
@@ -235,6 +238,27 @@
</reporting>
<profiles>
+ <profile>
+ <id>Windows</id>
+ <activation>
+ <os><family>windows</family></os>
+ </activation>
+ <properties>
+ <executable.python>python</executable.python>
+ <python.path.l>${project.basedir}\src\main\scripts;${project.basedir}\..\slider-agent\src\test\python\mock;${project.basedir}\src\test\python\scripts</python.path.l>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>Linux</id>
+ <activation>
+ <os><family>!windows</family></os>
+ </activation>
+ <properties>
+ <executable.python>${project.basedir}/../slider-agent/src/test/python/python-wrap</executable.python>
+ <python.path.l>${project.basedir}/src/main/scripts:${project.basedir}/../slider-agent/src/test/python/mock:${project.basedir}/src/test/python/scripts</python.path.l>
+ </properties>
+ </profile>
<profile>
<id>rpm</id>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/16a48dff/slider-assembly/src/test/python/unitTests.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/test/python/unitTests.py b/slider-assembly/src/test/python/unitTests.py
index aebf4ba..ec1a78c 100644
--- a/slider-assembly/src/test/python/unitTests.py
+++ b/slider-assembly/src/test/python/unitTests.py
@@ -32,7 +32,7 @@ ignoredDirs = ["mock"]
class TestAgent(unittest.TestSuite):
def run(self, result, debug=False):
run = unittest.TestSuite.run
- run(self, result, debug)
+ run(self, result)
return result
[2/3] incubator-slider git commit: SLIDER-630. slider-agent unit
tests fail on debian and suse and windows
Posted by sm...@apache.org.
SLIDER-630. slider-agent unit tests fail on debian and suse and windows
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/131221e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/131221e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/131221e3
Branch: refs/heads/releases/slider-0.60
Commit: 131221e38a9bca00f63383fb566203ebfcc0a985
Parents: 16a48df
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Sun Nov 9 14:34:38 2014 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Sun Nov 9 15:07:12 2014 -0800
----------------------------------------------------------------------
slider-agent/src/test/python/agent/TestPythonExecutor.py | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/131221e3/slider-agent/src/test/python/agent/TestPythonExecutor.py
----------------------------------------------------------------------
diff --git a/slider-agent/src/test/python/agent/TestPythonExecutor.py b/slider-agent/src/test/python/agent/TestPythonExecutor.py
index 9a46bd5..0a43639 100644
--- a/slider-agent/src/test/python/agent/TestPythonExecutor.py
+++ b/slider-agent/src/test/python/agent/TestPythonExecutor.py
@@ -33,6 +33,7 @@ from PythonExecutor import PythonExecutor
from AgentConfig import AgentConfig
from mock.mock import MagicMock, patch
from AgentToggleLogger import AgentToggleLogger
+import os
class TestPythonExecutor(TestCase):
def setUp(self):
[3/3] incubator-slider git commit: SLIDER-630. slider-assembly unit
tests fail on debian and suse and windows
Posted by sm...@apache.org.
SLIDER-630. slider-assembly unit tests fail on debian and suse and windows
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/a036ec11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/a036ec11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/a036ec11
Branch: refs/heads/releases/slider-0.60
Commit: a036ec112331fa33aebcb5df0464579d2ae4d6b6
Parents: 131221e
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Sun Nov 9 14:56:19 2014 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Sun Nov 9 15:07:25 2014 -0800
----------------------------------------------------------------------
.../src/test/python/scripts/TestSlider.py | 24 +++++++++++++++-----
1 file changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/a036ec11/slider-assembly/src/test/python/scripts/TestSlider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/test/python/scripts/TestSlider.py b/slider-assembly/src/test/python/scripts/TestSlider.py
index 6fe2a47..0ed5386 100644
--- a/slider-assembly/src/test/python/scripts/TestSlider.py
+++ b/slider-assembly/src/test/python/scripts/TestSlider.py
@@ -25,28 +25,40 @@ import unittest
import logging
import slider
import os
+import platform
+
+IS_WINDOWS = platform.system() == "Windows"
logger = logging.getLogger()
class TestSlider(unittest.TestCase):
+ @patch("os.environ.get")
@patch.object(slider, "confDir")
@patch.object(slider, "libDir")
@patch.object(slider, "executeEnvSh")
@patch("os.path.exists")
@patch.object(slider, "java")
- def test_main(self, java_mock, exists_mock, executeEnvSh_mock, libDir_mock, confDir_mock):
+ def test_main(self, java_mock, exists_mock, executeEnvSh_mock, libDir_mock, confDir_mock, os_env_get_mock):
sys.argv = ["slider", "list"]
exists_mock.return_value = True
libDir_mock.return_value = "/dir/libdir"
confDir_mock.return_value = "/dir/confdir"
+ os_env_get_mock.return_value = "env_val"
slider.main()
self.assertTrue(java_mock.called)
- java_mock.assert_called_with(
- 'org.apache.slider.Slider',
- ['list'],
- '/dir/libdir/*:/dir/confdir::',
- ['-Dslider.confdir=/dir/confdir', '-Dslider.libdir=/dir/libdir', '-Djava.net.preferIPv4Stack=true', '-Djava.awt.headless=true', '-Xmx256m'])
+ if IS_WINDOWS:
+ java_mock.assert_called_with(
+ 'org.apache.slider.Slider',
+ ['list'],
+ '/dir/libdir\\*;/dir/confdir;env_val;env_val',
+ ['-Dslider.confdir=/dir/confdir', '-Dslider.libdir=/dir/libdir', 'env_val'])
+ else:
+ java_mock.assert_called_with(
+ 'org.apache.slider.Slider',
+ ['list'],
+ '/dir/libdir/*:/dir/confdir:env_val:env_val',
+ ['-Dslider.confdir=/dir/confdir', '-Dslider.libdir=/dir/libdir', 'env_val'])
pass