Skip to content

Commit

Permalink
FIXUP: scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rjeffman committed Jun 29, 2024
1 parent 95d9e03 commit c803ec9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
15 changes: 8 additions & 7 deletions utils/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"}
Expand Down Expand Up @@ -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'"
Expand All @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
10 changes: 2 additions & 8 deletions utils/setup_test_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" <<EOF || die "Failed to verify IPA or KDC services."
Expand Down
4 changes: 4 additions & 0 deletions utils/shcontainer
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ start_container() {
local scenario="${1:-${scenario}}"
log info "Starting container for ${scenario}..."
quiet "${engine}" start "${scenario}"
# With docker on Ubuntu, it might take a couple of seconds
# for the container to be available.
sleep 3
run_if_exists ansible_ping "${inventory}"
run_if_exists query_container_installed_software
}

Expand Down

0 comments on commit c803ec9

Please sign in to comment.