diff --git a/utils/run-tests.sh b/utils/run-tests.sh index fe1eb720f4..e814aed014 100755 --- a/utils/run-tests.sh +++ b/utils/run-tests.sh @@ -32,7 +32,7 @@ interrupt_exception() { usage() { local prog="${0##*/}" cat </dev/null 2>&1 then + [ ${SPLITS} -ne 0 ] && die -u "Can't define tests and use '-A'" ENABLED_TESTS+=($(basename "${test}" .yml)) else log error "Test not found: ${test}" fi done -[ ${#ENABLED_MODULES[@]} -eq 0 ] && [ ${#ENABLED_TESTS[@]} -eq 0 ] && die -u "No test defined." +[ ${SPLITS} -eq 0 ] && [ ${#ENABLED_MODULES[@]} -eq 0 ] && [ ${#ENABLED_TESTS[@]} -eq 0 ] && die -u "No test defined." # Prepare virtual environment VENV=$(in_python_virtualenv && echo Y || echo N) @@ -373,23 +393,31 @@ EOF # run tests RESULT=0 -# shellcheck disable=SC2086 + export RUN_TESTS_IN_DOCKER=${engine} export IPA_SERVER_HOST="${scenario}" -joined="$(printf "%s," "${ENABLED_MODULES[@]}")" -# shelcheck disable=SC2178 -IPA_ENABLED_MODULES="${joined%,}" -joined="$(printf "%s," "${ENABLED_TESTS[@]}")" -# shelcheck disable=SC2178 -IPA_ENABLED_TESTS="${joined%,}" -export IPA_ENABLED_MODULES IPA_ENABLED_TESTS -[ -n "${IPA_ENABLED_MODULES}" ] && log info "Test suites: ${IPA_ENABLED_MODULES}" -[ -n "${IPA_ENABLED_TESTS}" ] && log info "Individual tests: ${IPA_ENABLED_TESTS}" +if [ ${SPLITS} -ne 0 ] +then + EXTRA_OPTIONS="${EXTRA_OPTIONS} --splits=${SPLITS} --group=${GROUP} --randomly-seed=${SEED}" + log info "Running tests for group ${GROUP} of ${SPLITS} with seed ${SEED}" +else + # shellcheck disable=SC2086 + joined="$(printf "%s," "${ENABLED_MODULES[@]}")" + # shelcheck disable=SC2178 + IPA_ENABLED_MODULES="${joined%,}" + joined="$(printf "%s," "${ENABLED_TESTS[@]}")" + # shelcheck disable=SC2178 + IPA_ENABLED_TESTS="${joined%,}" + export IPA_ENABLED_MODULES IPA_ENABLED_TESTS + [ -n "${IPA_ENABLED_MODULES}" ] && log info "Test suites: ${IPA_ENABLED_MODULES}" + [ -n "${IPA_ENABLED_TESTS}" ] && log info "Individual tests: ${IPA_ENABLED_TESTS}" +fi IPA_VERBOSITY="${verbose}" [ -n "${IPA_VERBOSITY}" ] && export IPA_VERBOSITY -if ! pytest -m "playbook" --verbose --color=yes +# shellcheck disable=SC2086 +if ! pytest -m "playbook" --verbose --color=yes ${EXTRA_OPTIONS} then RESULT=2 log error "Container not stopped for verification: ${scenario}"