Skip to content

Commit

Permalink
fixup! utils: Rewrite run-tests.sh to use functions and extenal scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rjeffman committed Jul 1, 2024
1 parent 4c553ae commit 4aceb9d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions utils/setup_test_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
6 changes: 3 additions & 3 deletions utils/shansible
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
1 change: 1 addition & 0 deletions utils/shcontainer
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion utils/shfun
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4aceb9d

Please sign in to comment.