summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/collection/setup.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
commit8a754e0858d922e955e71b253c139e071ecec432 (patch)
tree527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/collection/setup.sh
parentInitial commit. (diff)
downloadansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz
ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/collection/setup.sh')
-rwxr-xr-xtest/integration/targets/collection/setup.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/integration/targets/collection/setup.sh b/test/integration/targets/collection/setup.sh
new file mode 100755
index 0000000..f1b33a5
--- /dev/null
+++ b/test/integration/targets/collection/setup.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+# Source this file from collection integration tests.
+#
+# It simplifies several aspects of collection testing:
+#
+# 1) Collection tests must be executed outside of the ansible source tree.
+# Otherwise ansible-test will test the ansible source instead of the test collection.
+# The temporary directory provided by ansible-test resides within the ansible source tree.
+#
+# 2) Sanity test ignore files for collections must be versioned based on the ansible-core version being used.
+# This script generates an ignore file with the correct filename for the current ansible-core version.
+#
+# 3) Sanity tests which are multi-version require an ignore entry per Python version.
+# This script replicates these ignore entries for each supported Python version based on the ignored path.
+
+set -eu -o pipefail
+
+export TEST_DIR
+export WORK_DIR
+
+TEST_DIR="$PWD"
+WORK_DIR="$(mktemp -d)"
+
+trap 'rm -rf "${WORK_DIR}"' EXIT
+
+cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
+cd "${WORK_DIR}/ansible_collections/ns/col"
+
+"${TEST_DIR}/../collection/update-ignore.py"