From 4aceb9d7e91d2cf74e685a3114ca7b617eb67d8e Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Mon, 1 Jul 2024 18:34:28 +0000 Subject: [PATCH] fixup! utils: Rewrite run-tests.sh to use functions and extenal scripts --- utils/setup_test_container.sh | 2 ++ utils/shansible | 6 +++--- utils/shcontainer | 1 + utils/shfun | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/setup_test_container.sh b/utils/setup_test_container.sh index fe6e144424..1553d18112 100755 --- a/utils/setup_test_container.sh +++ b/utils/setup_test_container.sh @@ -66,6 +66,8 @@ do esac done +export HOSTNAME MEMORY IMAGE_TAG scenario + shift $((OPTIND - 1)) [ $# == 1 ] || die -u "You must provide the name for a single container." scenario="${1}" diff --git a/utils/shansible b/utils/shansible index 4914456f60..cf43f0bebc 100644 --- a/utils/shansible +++ b/utils/shansible @@ -24,9 +24,9 @@ install_ansible() { run_inline_playbook() { local playbookdir playbook err - playbookdir=${1:-"/tmp/playbooks"} + playbookdir=${1:-"playbooks"} playbook=$(mktemp "${playbookdir}/ansible-freeipa-test-playbook_ipa.XXXXXXXX") - inventory="${inventory:-${test_env:-/tmp}/inventory}" + inventory="${inventory:-${test_env:-"."}/inventory}" quiet mkdir -p "${playbookdir}" cat - >"${playbook}" # shellcheck disable=SC2086 @@ -41,7 +41,7 @@ make_inventory() { scenario=$1 pod_engine="${engine:-${2:-podman}}" ansible_interpreter="${3:-${ansible_interpreter:-"/usr/bin/python3"}}" - export inventory="${test_env:-/tmp}/inventory" + export inventory="${test_env:-"."}/inventory" log info "Inventory file: ${inventory}" cat << EOF > "${inventory}" [ipaserver] diff --git a/utils/shcontainer b/utils/shcontainer index 633c66b03d..2398d0691f 100644 --- a/utils/shcontainer +++ b/utils/shcontainer @@ -31,6 +31,7 @@ prepare_container() { # Retrieve image and start container. log info "Pulling FreeIPA image '${IMAGE_REPO}:${IMAGE_TAG}'..." img_id=$(${engine} pull -q "${IMAGE_REPO}:${IMAGE_TAG}") + log debug "Hostname: ${hostname}" log info "Creating container..." CONFIG="--systemd true --hostname ${hostname} --memory ${MEMORY}g --memory-swap -1" [ -n "${scenario}" ] && CONFIG="${CONFIG} --name ${scenario}" diff --git a/utils/shfun b/utils/shfun index d6d8d6c3a5..68596cee18 100644 --- a/utils/shfun +++ b/utils/shfun @@ -79,7 +79,7 @@ start_virtual_environment() { while getopts ":f" option do case "$option" in - f) FORCE_ENV="Y" + f) FORCE_ENV="Y" ;; *) die "prepare_virtual_environment: Invalid option: ${option}" ;; esac done