diff --git a/tests/check_samples/__init__.py b/tests/check_samples/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/functional/test_task_samples.py b/tests/check_samples/test_task_samples.py similarity index 100% rename from tests/functional/test_task_samples.py rename to tests/check_samples/test_task_samples.py diff --git a/tests/ci/pytest_launcher.py b/tests/ci/pytest_launcher.py index d1e76d1072..911acd44bd 100755 --- a/tests/ci/pytest_launcher.py +++ b/tests/ci/pytest_launcher.py @@ -25,7 +25,7 @@ PYTEST_ARGUMENTS = ("py.test" # base command " --html=%(html_report)s" # html report " --self-contained-html" # embedded css " --durations=10" # get a list of the slowest 10 tests - " -n auto" # launch tests in parallel + " -n %(concurrency)s" # launch tests in parallel " %(path)s" ) @@ -42,9 +42,8 @@ def main(args): parser.add_argument("--posargs", metavar="", type=str, default="", help="TOX posargs. Currently supported only string to " "partial test or tests group to launch.") - parser.add_argument("--timeout", metavar="", type=int, default=60, - help="Timeout for individual test execution. " - "Defaults to 60") + parser.add_argument("--concurrency", metavar="", type=int, + help="Number of parallel processes.") args = parser.parse_args(args[1:]) # We allow only one parameter - path to partial test or tests group @@ -99,7 +98,7 @@ def main(args): args = PYTEST_ARGUMENTS % {"html_report": pytest_report, "path": path, - "timeout": args.timeout} + "concurrency": args.concurrency or "auto"} try: subprocess.check_call(args.split(" "), stderr=subprocess.STDOUT) diff --git a/tests/ci/rally_cli_job.sh b/tests/ci/rally_cli_job.sh new file mode 100755 index 0000000000..1fe87b47b1 --- /dev/null +++ b/tests/ci/rally_cli_job.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +LOCAL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +DB_CONNECTION="$(rally-manage db show)" + +if [[ $DB_CONNECTION == sqlite* ]]; then + CONCURRENCY=0 +else + # in case of not sqlite db backends we cannot launch tests in parallel due + # to possible conflicts + CONCURRENCY=1 + # currently, RCI_KEEP_DB variable is used to not create new databases per + # each test + export RCI_KEEP_DB=1 +fi + + +python $LOCAL_DIR/pytest_launcher.py "tests/functional" --concurrency $CONCURRENCY + +python $LOCAL_DIR/pytest_launcher.py "tests/check_samples" diff --git a/tox.ini b/tox.ini index f132cde34d..599f44909d 100644 --- a/tox.ini +++ b/tox.ini @@ -57,7 +57,7 @@ commands = oslo_debug_helper -t tests {posargs} sitepackages = True commands = find . -type f -name "*.pyc" -delete - python {toxinidir}/tests/ci/pytest_launcher.py "tests/functional" --timeout -1 --posargs={posargs} + {toxinidir}/tests/ci/rally_cli_job.sh [testenv:cover] commands = {toxinidir}/tests/ci/cover.sh {posargs}