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 <smoha...@hortonworks.com> Authored: Sun Nov 9 14:26:54 2014 -0800 Committer: Sumit Mohanty <smoha...@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