You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by st...@apache.org on 2016/09/28 11:59:01 UTC
ambari git commit: AMBARI-18401. Allow running a subset of Python
unit tests. (Attila Doroszlai via stoader)
Repository: ambari
Updated Branches:
refs/heads/trunk 2700bd125 -> 39858ccaf
AMBARI-18401. Allow running a subset of Python unit tests. (Attila Doroszlai via stoader)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/39858cca
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/39858cca
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/39858cca
Branch: refs/heads/trunk
Commit: 39858ccafcee6c49bba21d7385d7129d71dc8851
Parents: 2700bd1
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Wed Sep 28 13:58:32 2016 +0200
Committer: Toader, Sebastian <st...@hortonworks.com>
Committed: Wed Sep 28 13:58:32 2016 +0200
----------------------------------------------------------------------
ambari-server/pom.xml | 2 ++
ambari-server/src/test/python/unitTests.py | 25 ++++++++++---------------
2 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/39858cca/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 354b6cb..d507b82 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -28,6 +28,7 @@
<!-- On centos the python xml's are inside python package -->
<deb.architecture>amd64</deb.architecture>
<custom.tests>false</custom.tests>
+ <python.test.mask>[Tt]est*.py</python.test.mask>
<hdpUrlForCentos6>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.1.0</hdpUrlForCentos6>
<hdpLatestUrl>http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json</hdpLatestUrl>
<ambari_commons.install.dir>/usr/lib/ambari-server/lib/ambari_commons</ambari_commons.install.dir>
@@ -621,6 +622,7 @@
<arguments>
<argument>unitTests.py</argument>
<argument>${custom.tests}</argument>
+ <argument>${python.test.mask}</argument>
</arguments>
<environmentVariables>
<PYTHONPATH>${path.python.1}${pathsep}$PYTHONPATH</PYTHONPATH>
http://git-wip-us.apache.org/repos/asf/ambari/blob/39858cca/ambari-server/src/test/python/unitTests.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/unitTests.py b/ambari-server/src/test/python/unitTests.py
index 037b6a5..7941ed3 100644
--- a/ambari-server/src/test/python/unitTests.py
+++ b/ambari-server/src/test/python/unitTests.py
@@ -86,17 +86,12 @@ def get_stack_name():
def get_stack_name():
return "HDP"
-def stack_test_executor(base_folder, service, stack, custom_tests, executor_result):
+def stack_test_executor(base_folder, service, stack, test_mask, executor_result):
"""
Stack tests executor. Must be executed in separate process to prevent module
name conflicts in different stacks.
"""
#extract stack scripts folders
- if custom_tests:
- test_mask = CUSTOM_TEST_MASK
- else:
- test_mask = TEST_MASK
-
server_src_dir = get_parent_path(base_folder, 'src')
script_folders = set()
@@ -152,10 +147,14 @@ def stack_test_executor(base_folder, service, stack, custom_tests, executor_resu
def main():
if not os.path.exists(newtmpdirpath): os.makedirs(newtmpdirpath)
- custom_tests = False
- if len(sys.argv) > 1:
- if sys.argv[1] == "true":
- custom_tests = True
+
+ if len(sys.argv) > 1 and sys.argv[1] == "true": # handle custom_tests for backward-compatibility
+ test_mask = CUSTOM_TEST_MASK
+ elif len(sys.argv) > 2:
+ test_mask = sys.argv[2]
+ else:
+ test_mask = TEST_MASK
+
pwd = os.path.abspath(os.path.dirname(__file__))
ambari_server_folder = get_parent_path(pwd, 'ambari-server')
@@ -212,7 +211,7 @@ def main():
args=(variant['directory'],
variant['service'],
variant['stack'],
- custom_tests,
+ test_mask,
executor_result)
)
process.start()
@@ -238,10 +237,6 @@ def main():
#run base ambari-server tests
sys.stderr.write("Running tests for ambari-server\n")
- if custom_tests:
- test_mask = CUSTOM_TEST_MASK
- else:
- test_mask = TEST_MASK
test_dirs = [
(os.path.join(pwd, 'custom_actions'), "\nRunning tests for custom actions\n"),