66f52b74b1
* Change collection PS util import pattern * Add changes for py2 compat * fix up regex and doc errors * fix up import analysis * Sanity fix for 2.6 CI workers * Get collection util path for coverage collection
36 lines
1.3 KiB
Bash
Executable file
36 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -eux
|
|
|
|
export ANSIBLE_COLLECTIONS_PATHS=$PWD/collection_root_user:$PWD/collection_root_sys
|
|
export ANSIBLE_GATHERING=explicit
|
|
export ANSIBLE_GATHER_SUBSET=minimal
|
|
export ANSIBLE_HOST_PATTERN_MISMATCH=error
|
|
|
|
# FIXME: just use INVENTORY_PATH as-is once ansible-test sets the right dir
|
|
ipath=../../$(basename "${INVENTORY_PATH}")
|
|
export INVENTORY_PATH="$ipath"
|
|
|
|
# test callback
|
|
ANSIBLE_CALLBACK_WHITELIST=testns.testcoll.usercallback ansible localhost -m ping | grep "usercallback says ok"
|
|
|
|
# test documentation
|
|
ansible-doc testns.testcoll.testmodule -vvv | grep -- "- normal_doc_frag"
|
|
|
|
echo "testing bad doc_fragments (expected ERROR message follows)"
|
|
# test documentation failure
|
|
ansible-doc testns.testcoll.testmodule_bad_docfrags -vvv 2>&1 | grep -- "unknown doc_fragment"
|
|
|
|
# we need multiple plays, and conditional import_playbook is noisy and causes problems, so choose here which one to use...
|
|
if [[ ${INVENTORY_PATH} == *.winrm ]]; then
|
|
export TEST_PLAYBOOK=windows.yml
|
|
else
|
|
export TEST_PLAYBOOK=posix.yml
|
|
fi
|
|
|
|
# run test playbook
|
|
ansible-playbook -i "${INVENTORY_PATH}" -i ./a.statichost.yml -v "${TEST_PLAYBOOK}" "$@"
|
|
|
|
# test adjacent with --playbook-dir
|
|
export ANSIBLE_COLLECTIONS_PATHS=''
|
|
ANSIBLE_INVENTORY_ANY_UNPARSED_IS_FAILED=1 ansible-inventory -i a.statichost.yml --list --export --playbook-dir=. -v "$@"
|