utils: Rewrite run-tests.sh to use functions and extenal scripts

To modify Azure tests and depend on shell scripts and pytest instead
of molecule, the run-tests.sh script has been rewritten to depend on
bash functions and on a bash script that prepare and start a testing
container.

This patch adds a new script, 'utils/setup_test_container.sh' that
can be used to start a new container, using either podman or docker,
based on the available ansible-freeipa images. The new container can
then be used to run ansible-freeipa tests against it.

Also the following files with bash functions were added, and are
used by both scripts:

    utils/shansible: Functions to run playbooks in the container
    utils/shcontainer: Functions to setup/run a container
    utils/shfun: Generic shell helper functions (e.g.: log)
This commit is contained in:
Rafael Guterres Jeffman
2024-06-26 14:46:53 +00:00
committed by Thomas Woerner
parent 0c6a7c8a14
commit 68bca84481
5 changed files with 337 additions and 300 deletions

View File

@@ -14,6 +14,8 @@ die() {
TOPDIR="$(dirname "${BASH_SOURCE[0]}")/.."
[ -n "$(command -v python3)" ] && python="$(command -v python3)" || python="$(command -v python2)"
pushd "${TOPDIR}" >/dev/null 2>&1 || die "Failed to change directory."
files_list=$(mktemp)
@@ -25,7 +27,7 @@ git diff "${remote}/master" --name-only > "${files_list}"
git remote remove ${remote}
# Get all modules that should have tests executed
enabled_modules="$(python utils/get_test_modules.py $(cat "${files_list}"))"
enabled_modules="$(${python} utils/get_test_modules.py $(cat "${files_list}"))"
[ -z "${enabled_modules}" ] && enabled_modules="None"
# Get individual tests that should be executed