From c803ec9eb60fb3c2fd2d5fc1a3a061fd3ff62892 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Sat, 29 Jun 2024 20:55:44 +0000 Subject: [PATCH] FIXUP: scripts --- utils/run-tests.sh | 15 ++++++++------- utils/setup_test_container.sh | 10 ++-------- utils/shcontainer | 4 ++++ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/utils/run-tests.sh b/utils/run-tests.sh index 2338ec48bf..6d459b749f 100755 --- a/utils/run-tests.sh +++ b/utils/run-tests.sh @@ -54,13 +54,13 @@ STOP_CONTAINER="Y" STOP_VIRTUALENV="N" declare -a ENABLED_MODULES declare -a ENABLED_TESTS -ENABLED_MODULES=() -ENABLED_TESTS=() +read -a ENABLED_MODULES <<< "${IPA_ENABLED_MODULES:-""}" +read -a ENABLED_TESTS <<< "${IPA_ENABLED_MODULES:-""}" IMAGE_TAG="fedora-latest" scenario="freeipa-tests" MEMORY=3 HOSTNAME="ipaserver.test.local" -SEED="" +SEED="$(date "+%Y%m%d")" GROUP=0 SPLITS=0 ANSIBLE_COLLECTIONS=${ANSIBLE_COLLECTIONS:-"${engine_collection}"} @@ -118,14 +118,15 @@ done export STOP_CONTAINER FORCE_ENV STOP_VIRTUALENV + +[ ${SPLITS} -eq 0 ] && [ ${#ENABLED_MODULES[@]} -eq 0 ] && [ ${#ENABLED_TESTS[@]} -eq 0 ] && die -u "No test defined." + # Ensure $python is set. [ -z "${python}" ] && python="python3" log info "Controller python executable: ${python}" ${python} --version -[ ${SPLITS} -eq 0 ] && [ ${#ENABLED_MODULES[@]} -eq 0 ] && [ ${#ENABLED_TESTS[@]} -eq 0 ] && die -u "No test defined." - # Prepare virtual environment start_python_virtual_environment log info "Installing dependencies from 'requirements-tests.txt'" @@ -136,7 +137,7 @@ install_ansible # Ansible configuration export ANSIBLE_ROLES_PATH="${TOPDIR}/roles" -export ANSIBLE_LIBRARY="${TOPDIR}/plugins:${TOPDIR}/molecule" +export ANSIBLE_LIBRARY="${TOPDIR}/plugins" export ANSIBLE_MODULE_UTILS="${TOPDIR}/plugins/module_utils" # start_container @@ -169,7 +170,7 @@ IPA_VERBOSITY="${verbose}" [ -n "${IPA_VERBOSITY}" ] && export IPA_VERBOSITY # shellcheck disable=SC2086 -if ! pytest -m "playbook" --verbose --color=yes ${EXTRA_OPTIONS} +if ! pytest -m "playbook" --verbose --color=yes --suppress-no-test-exit-code --junit-xml=TEST-results-group-${GROUP_NUMBER}.xml ${EXTRA_OPTIONS} then RESULT=2 log error "Container not stopped for verification: ${scenario}" diff --git a/utils/setup_test_container.sh b/utils/setup_test_container.sh index ff86a60d0c..938e16bc61 100755 --- a/utils/setup_test_container.sh +++ b/utils/setup_test_container.sh @@ -67,16 +67,10 @@ shift $((OPTIND - 1)) scenario="${1}" shift -prepare_container "${scenario}" "${IMAGE_TAG}" -start_container "${scenario}" - -# With docker on Ubuntu, it might take a couple of seconds -# for the container to be available. -sleep 3 - make_inventory "${scenario}" "${engine:-podman}" -ansible_ping "${inventory}" +prepare_container "${scenario}" "${IMAGE_TAG}" +start_container "${scenario}" # configure ipaserver dns resolver to point to itself run_inline_playbook "${test_env}/playbooks" <