Split up ansible-test integration tests. (#78520)

* Relocate venv-pythons.py script.

* Split out unsupported-directory test.

* Split out sanity-import test.

* Split out sanity-validate-modules test.

* Split out units test.

* Split out integration test.

* Split out units-constraints test.

* Split out integration-constraints test.

* Split out coverage test.

* Split out sanity test.

* Split out git test.

* Update test groups.
pull/78528/head
Matt Clay 2 years ago committed by GitHub
parent 0de4480467
commit 135f95fb2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,4 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection

@ -0,0 +1,6 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
def test_coverage():
pass

@ -1,11 +1,8 @@
#!/usr/bin/env bash
set -eux -o pipefail
source ../collection/setup.sh
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
cd "${WORK_DIR}/ansible_collections/ns/col"
"${TEST_DIR}/../collection/update-ignore.py"
set -x
# common args for all tests
common=(--venv --color --truncate 0 "${@}")

@ -0,0 +1,4 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection

@ -0,0 +1,4 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection

@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../collection/setup.sh
set -x
ansible-test integration --venv --color --truncate 0 "${@}"

@ -0,0 +1,4 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection

@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../collection/setup.sh
set -x
ansible-test integration --venv --color --truncate 0 "${@}"

@ -0,0 +1,5 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection
destructive # adds and then removes packages into lib/ansible/_vendor/

@ -1,11 +1,6 @@
#!/usr/bin/env bash
set -eux -o pipefail
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
cd "${WORK_DIR}/ansible_collections/ns/col"
"${TEST_DIR}/../collection/update-ignore.py"
source ../collection/setup.sh
vendor_dir="$(python -c 'import pathlib, ansible._vendor; print(pathlib.Path(ansible._vendor.__file__).parent)')"

@ -0,0 +1,4 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection

@ -0,0 +1,3 @@
README
------
This is a simple PowerShell-only collection used to verify that ``ansible-test`` works on a collection.

@ -0,0 +1,6 @@
namespace: ns
name: ps_only
version: 1.0.0
readme: README.rst
authors:
- Ansible

@ -1,9 +1,12 @@
#!/usr/bin/env bash
set -eux -o pipefail
source ../collection/setup.sh
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
cd "${WORK_DIR}/ansible_collections/ns/ps_only"
set -eux
ansible-test sanity --test validate-modules --color --truncate 0 "${@}"
cd ../ps_only
if ! command -V pwsh; then
echo "skipping test since pwsh is not available"

@ -0,0 +1,4 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection

@ -0,0 +1,7 @@
#!/usr/bin/env bash
source ../collection/setup.sh
set -x
ansible-test sanity --color --truncate 0 "${@}"

@ -0,0 +1,5 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection
needs/target/ansible-test

@ -0,0 +1,10 @@
#!/usr/bin/env bash
source ../collection/setup.sh
set -x
options=$("${TEST_DIR}"/../ansible-test/venv-pythons.py)
IFS=', ' read -r -a pythons <<< "${options}"
ansible-test units --color --truncate 0 "${pythons[@]}" "${@}"

@ -0,0 +1,5 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection
needs/target/ansible-test

@ -0,0 +1,6 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
def hello(name):
return 'Hello %s' % name

@ -0,0 +1,46 @@
#!/usr/bin/python
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
module: hello
short_description: Hello test module
description: Hello test module.
options:
name:
description: Name to say hello to.
type: str
author:
- Ansible Core Team
'''
EXAMPLES = '''
- hello:
'''
RETURN = ''''''
from ansible.module_utils.basic import AnsibleModule
from ..module_utils.my_util import hello
def main():
module = AnsibleModule(
argument_spec=dict(
name=dict(type='str'),
),
)
module.exit_json(**say_hello(module.params['name']))
def say_hello(name):
return dict(
message=hello(name),
)
if __name__ == '__main__':
main()

@ -0,0 +1,10 @@
#!/usr/bin/env bash
source ../collection/setup.sh
set -x
options=$("${TEST_DIR}"/../ansible-test/venv-pythons.py)
IFS=', ' read -r -a pythons <<< "${options}"
ansible-test units --color --truncate 0 "${pythons[@]}" "${@}"

@ -0,0 +1,4 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection

@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -eux -o pipefail
source ../collection/setup.sh
set -eux
cd "${WORK_DIR}"
@ -11,6 +13,9 @@ ansible-test --version
# the --help option should show the current working directory when it is unsupported
ansible-test --help 2>&1 | grep '^Current working directory: '
# some shell commands also work without a supported directory
ansible-test shell pwd
if ansible-test sanity 1>stdout 2>stderr; then
echo "ansible-test did not fail"
exit 1

@ -1,5 +1 @@
shippable/posix/group3 # runs in the distro test containers
shippable/generic/group1 # runs in the default test container
context/controller
needs/target/collection
destructive # adds and then removes packages into lib/ansible/_vendor/
hidden

@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -eux -o pipefail
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
cd "${WORK_DIR}/ansible_collections/ns/col_constraints"
ansible-test integration --venv --color --truncate 0 "${@}"

@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -eux -o pipefail
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
cd "${WORK_DIR}/ansible_collections/ns/col"
ansible-test integration --venv --color --truncate 0 "${@}"

@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -eux -o pipefail
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
cd "${WORK_DIR}/ansible_collections/ns/col"
"${TEST_DIR}/../collection/update-ignore.py"
ansible-test sanity --color --truncate 0 "${@}"

@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -eux -o pipefail
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
cd "${WORK_DIR}/ansible_collections/ns/col_constraints"
options=$("${TEST_DIR}"/collection-tests/venv-pythons.py)
IFS=', ' read -r -a pythons <<< "${options}"
ansible-test units --color --truncate 0 "${pythons[@]}" "${@}"

@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -eux -o pipefail
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
cd "${WORK_DIR}/ansible_collections/ns/col"
options=$("${TEST_DIR}"/collection-tests/venv-pythons.py)
IFS=', ' read -r -a pythons <<< "${options}"
ansible-test units --color --truncate 0 "${pythons[@]}" "${@}"

@ -118,12 +118,13 @@ lib/ansible/plugins/strategy/linear.py pylint:disallowed-name
lib/ansible/utils/collection_loader/_collection_finder.py pylint:deprecated-class
lib/ansible/utils/collection_loader/_collection_meta.py pylint:deprecated-class
lib/ansible/vars/hostvars.py pylint:disallowed-name
test/integration/targets/ansible-test/ansible_collections/ns/col/plugins/modules/hello.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-function # ignore, required for testing
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import-from # ignore, required for testing
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import # ignore, required for testing
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/unit/plugins/modules/test_hello.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/unit/plugins/module_utils/test_my_util.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test-sanity/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-function # ignore, required for testing
test/integration/targets/ansible-test-sanity/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import-from # ignore, required for testing
test/integration/targets/ansible-test-sanity/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import # ignore, required for testing
test/integration/targets/ansible-test-integration/ansible_collections/ns/col/plugins/modules/hello.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test-units/ansible_collections/ns/col/plugins/modules/hello.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test-units/ansible_collections/ns/col/tests/unit/plugins/modules/test_hello.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test-units/ansible_collections/ns/col/tests/unit/plugins/module_utils/test_my_util.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test-docker/ansible_collections/ns/col/plugins/modules/hello.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test-docker/ansible_collections/ns/col/tests/unit/plugins/modules/test_hello.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test-docker/ansible_collections/ns/col/tests/unit/plugins/module_utils/test_my_util.py pylint:relative-beyond-top-level

Loading…
Cancel
Save