#!/usr/bin/env bash # Copyright Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ## Shell Opts ---------------------------------------------------------------- set -o pipefail set -xeuo ## Vars ---------------------------------------------------------------------- PROJECT_DIR="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/../" USE_VENV=${USE_VENV:-yes} HOME=${HOME:-/tmp} ANSIBLE_GALAXY_RETIRES=5 export HOME=${HOME} export ANSIBLE_LOCAL_TMP=${HOME} export ANSIBLE_REMOTE_TMP=${HOME} ansible_test='ansible-test' collection_path='/usr/share/ansible/collections/ansible_collections' case ${USE_VENV} in y|yes|true): ansible_test="${HOME}/test-python/bin/ansible-test" collection_path="${HOME}/.ansible/collections/ansible_collections" ;; esac n=0 until [ "$n" -ge "$ANSIBLE_GALAXY_RETIRES" ]; do ansible-galaxy collection install --upgrade --force "${PROJECT_DIR}" && break n=$((n+1)) sleep 15 done # Create/append the sanity exceptions for the current ansible version ansible_version=$(python3 -c "import ansible; print(ansible.__version__)" | sed 's/\.[^.]*$//') cat "${HOME}/.ansible/collections/ansible_collections/cifmw/general/tests/sanity/ignore.txt" >> \ "${HOME}/.ansible/collections/ansible_collections/cifmw/general/tests/sanity/ignore-${ansible_version}.txt" pushd ${HOME}/.ansible/collections/ansible_collections/cifmw/general if [ -d tests/unit ]; then ${ansible_test} units --color=yes --requirements -vv fi ${ansible_test} sanity --test validate-modules if [ -d tests/integration ]; then ${ansible_test} integration --color=yes fi