Merge "[ci] Rework launching cli job"

This commit is contained in:
Jenkins 2017-08-03 07:42:00 +00:00 committed by Gerrit Code Review
commit d15d2c89e7
5 changed files with 26 additions and 6 deletions

View File

View File

@ -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="<str>", type=str, default="",
help="TOX posargs. Currently supported only string to "
"partial test or tests group to launch.")
parser.add_argument("--timeout", metavar="<seconds>", type=int, default=60,
help="Timeout for individual test execution. "
"Defaults to 60")
parser.add_argument("--concurrency", metavar="<N>", 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)

21
tests/ci/rally_cli_job.sh Executable file
View File

@ -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"

View File

@ -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}