summaryrefslogtreecommitdiffstats
path: root/ansible_collections/hetzner/hcloud/tests/utils/gitlab
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/hetzner/hcloud/tests/utils/gitlab')
-rwxr-xr-xansible_collections/hetzner/hcloud/tests/utils/gitlab/gitlab.sh68
-rwxr-xr-xansible_collections/hetzner/hcloud/tests/utils/gitlab/sanity.sh34
2 files changed, 50 insertions, 52 deletions
diff --git a/ansible_collections/hetzner/hcloud/tests/utils/gitlab/gitlab.sh b/ansible_collections/hetzner/hcloud/tests/utils/gitlab/gitlab.sh
index b09bd2f3a..a96ad2f4c 100755
--- a/ansible_collections/hetzner/hcloud/tests/utils/gitlab/gitlab.sh
+++ b/ansible_collections/hetzner/hcloud/tests/utils/gitlab/gitlab.sh
@@ -11,77 +11,73 @@ ansible_version="${args[0]}"
script="${args[1]}"
function join {
- local IFS="$1";
- shift;
- echo "$*";
+ local IFS="$1"
+ shift
+ echo "$*"
}
test="$(join / "${args[@]:1}")"
command -v python
python -V
-function retry
-{
- # shellcheck disable=SC2034
- for repetition in 1 2 3; do
- set +e
- "$@"
- result=$?
- set -e
- if [ ${result} == 0 ]; then
- return ${result}
- fi
- echo "@* -> ${result}"
- done
- echo "Command '@*' failed 3 times!"
- exit 1
+function retry {
+ # shellcheck disable=SC2034
+ for repetition in 1 2 3; do
+ set +e
+ "$@"
+ result=$?
+ set -e
+ if [ ${result} == 0 ]; then
+ return ${result}
+ fi
+ echo "@* -> ${result}"
+ done
+ echo "Command '@*' failed 3 times!"
+ exit 1
}
command -v pip
pip --version
pip list --disable-pip-version-check
if [ "${ansible_version}" == "devel" ]; then
- retry pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
+ retry pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
else
- retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check
+ retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check
fi
-export ANSIBLE_COLLECTIONS_PATHS="${HOME}/.ansible"
+export ANSIBLE_COLLECTIONS_PATH="${HOME}/.ansible"
# shellcheck disable=SC2034
SHIPPABLE_RESULT_DIR="$(pwd)/shippable"
-TEST_DIR="${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/hetzner/hcloud"
+TEST_DIR="${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/hetzner/hcloud"
rm -rf "${TEST_DIR}"
mkdir -p "${TEST_DIR}"
cp -r "." "${TEST_DIR}"
cd "${TEST_DIR}"
# STAR: HACK install dependencies
-retry ansible-galaxy -vvv collection install community.general
-retry ansible-galaxy -vvv collection install ansible.netcommon
-retry ansible-galaxy -vvv collection install community.internal_test_tools
-retry pip install netaddr --disable-pip-version-check
-retry pip install hcloud
+retry pip install -r tests/integration/requirements.txt -c tests/integration/constraints.txt
+retry ansible-galaxy -vvv collection install -r tests/requirements.yml
+
retry pip install rstcheck
+retry ansible-galaxy -vvv collection install community.internal_test_tools
# END: HACK
export PYTHONIOENCODING='utf-8'
if [ "${JOB_TRIGGERED_BY_NAME:-}" == "nightly-trigger" ]; then
- COMPLETE=yes
+ COMPLETE=yes
fi
-
if [ -n "${COMPLETE:-}" ]; then
- # disable change detection triggered by setting the COMPLETE environment variable to a non-empty value
- export CHANGED=""
+ # disable change detection triggered by setting the COMPLETE environment variable to a non-empty value
+ export CHANGED=""
elif [[ "${CI_COMMIT_MESSAGE}" =~ ci_complete ]]; then
- # disable change detection triggered by having 'ci_complete' in the latest commit message
- export CHANGED=""
+ # disable change detection triggered by having 'ci_complete' in the latest commit message
+ export CHANGED=""
else
- # enable change detection (default behavior)
- export CHANGED=""
+ # enable change detection (default behavior)
+ export CHANGED=""
fi
-
export UNSTABLE="--allow-unstable-changed"
# remove empty core/extras module directories from PRs created prior to the repo-merge
diff --git a/ansible_collections/hetzner/hcloud/tests/utils/gitlab/sanity.sh b/ansible_collections/hetzner/hcloud/tests/utils/gitlab/sanity.sh
index 4ee96aefe..9f6711b05 100755
--- a/ansible_collections/hetzner/hcloud/tests/utils/gitlab/sanity.sh
+++ b/ansible_collections/hetzner/hcloud/tests/utils/gitlab/sanity.sh
@@ -8,32 +8,32 @@ IFS='/:' read -ra args <<< "$1"
group="${args[1]}"
if [ "${BASE_BRANCH:-}" ]; then
- base_branch="origin/${BASE_BRANCH}"
+ base_branch="origin/${BASE_BRANCH}"
else
- base_branch=""
+ base_branch=""
fi
if [ "${group}" == "extra" ]; then
- ../internal_test_tools/tools/run.py --color
- exit
+ ../internal_test_tools/tools/run.py --color
+ exit
fi
case "${group}" in
- 1) options=(--skip-test pylint --skip-test ansible-doc --skip-test validate-modules) ;;
- 2) options=( --test ansible-doc --test validate-modules) ;;
- 3) options=(--test pylint plugins/modules/) ;;
- 4) options=(--test pylint --exclude plugins/modules/) ;;
+ 1) options=(--skip-test pylint --skip-test ansible-doc --skip-test validate-modules) ;;
+ 2) options=(--test ansible-doc --test validate-modules) ;;
+ 3) options=(--test pylint plugins/modules/) ;;
+ 4) options=(--test pylint --exclude plugins/modules/) ;;
esac
# allow collection migration sanity tests for groups 3 and 4 to pass without updating this script during migration
network_path="lib/ansible/modules/network/"
if [ -d "${network_path}" ]; then
- if [ "${group}" -eq 3 ]; then
- options+=(--exclude "${network_path}")
- elif [ "${group}" -eq 4 ]; then
- options+=("${network_path}")
- fi
+ if [ "${group}" -eq 3 ]; then
+ options+=(--exclude "${network_path}")
+ elif [ "${group}" -eq 4 ]; then
+ options+=("${network_path}")
+ fi
fi
pip install pycodestyle
@@ -42,6 +42,8 @@ pip install voluptuous
pip install pylint==2.5.3
# shellcheck disable=SC2086
ansible-test sanity --color -v --junit ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
- --base-branch "${base_branch}" \
- --exclude tests/utils/ \
- "${options[@]}" --allow-disabled
+ --base-branch "${base_branch}" \
+ --exclude plugins/module_utils/vendor/ \
+ --exclude scripts/ \
+ --exclude tests/utils/ \
+ "${options[@]}" --allow-disabled