diff options
author | Lee Garrett <lgarrett@rocketjump.eu> | 2022-09-13 16:39:18 +0200 |
---|---|---|
committer | Lee Garrett <lgarrett@rocketjump.eu> | 2022-09-13 16:39:18 +0200 |
commit | dfc95dfc10415e8ba138e2c042c39632c9251abb (patch) | |
tree | f0d4aac54ea7f6ef3ffb1b61d4a316fab0d2602c /test | |
parent | 5883937d823fe68e35dbedf2a9d45ecaf6636470 (diff) | |
download | debian-ansible-core-dfc95dfc10415e8ba138e2c042c39632c9251abb.zip |
New upstream version 2.13.4
Diffstat (limited to 'test')
24 files changed, 340 insertions, 21 deletions
diff --git a/test/integration/targets/ansible-galaxy-collection/library/setup_collections.py b/test/integration/targets/ansible-galaxy-collection/library/setup_collections.py index 58ec9b2a..35b18dec 100644 --- a/test/integration/targets/ansible-galaxy-collection/library/setup_collections.py +++ b/test/integration/targets/ansible-galaxy-collection/library/setup_collections.py @@ -87,6 +87,10 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_bytes from functools import partial from multiprocessing import dummy as threading +from multiprocessing import TimeoutError + + +COLLECTIONS_BUILD_AND_PUBLISH_TIMEOUT = 120 def publish_collection(module, collection): @@ -241,7 +245,14 @@ def run_module(): pool = threading.Pool(4) publish_func = partial(publish_collection, module) - result['results'] = pool.map(publish_func, module.params['collections']) + try: + result['results'] = pool.map_async( + publish_func, module.params['collections'], + ).get(timeout=COLLECTIONS_BUILD_AND_PUBLISH_TIMEOUT) + except TimeoutError as timeout_err: + module.fail_json( + 'Timed out waiting for collections to be provisioned.', + ) failed = bool(sum( r['build']['rc'] + r['publish']['rc'] for r in result['results'] diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/install.yml b/test/integration/targets/ansible-galaxy-collection/tasks/install.yml index 0068e76d..a55b64d8 100644 --- a/test/integration/targets/ansible-galaxy-collection/tasks/install.yml +++ b/test/integration/targets/ansible-galaxy-collection/tasks/install.yml @@ -423,6 +423,15 @@ - (install_req_actual.results[0].content | b64decode | from_json).collection_info.version == '1.0.0' - (install_req_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0' +- name: Test deviations on -r and --role-file without collection or role sub command + command: '{{ cmd }}' + loop: + - ansible-galaxy install -vr '{{ galaxy_dir }}/ansible_collections/requirements.yaml' -s '{{ test_name }}' -vv + - ansible-galaxy install --role-file '{{ galaxy_dir }}/ansible_collections/requirements.yaml' -s '{{ test_name }}' -vvv + - ansible-galaxy install --role-file='{{ galaxy_dir }}/ansible_collections/requirements.yaml' -s '{{ test_name }}' -vvv + loop_control: + loop_var: cmd + - name: uninstall collections for next requirements file test file: path: '{{ galaxy_dir }}/ansible_collections/{{ collection }}/name' diff --git a/test/integration/targets/ansible-test-sanity-ansible-doc/aliases b/test/integration/targets/ansible-test-sanity-ansible-doc/aliases new file mode 100644 index 00000000..7741d444 --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-ansible-doc/aliases @@ -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 diff --git a/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/lookup/a/b/lookup2.py b/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/lookup/a/b/lookup2.py new file mode 100644 index 00000000..5cd2cf0f --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/lookup/a/b/lookup2.py @@ -0,0 +1,28 @@ +# 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 = """ + name: lookup2 + author: Ansible Core Team + short_description: hello test lookup + description: + - Hello test lookup. + options: {} +""" + +EXAMPLES = """ +- minimal: +""" + +RETURN = """ +""" + +from ansible.plugins.lookup import LookupBase + + +class LookupModule(LookupBase): + + def run(self, terms, variables=None, **kwargs): + return [] diff --git a/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/lookup/lookup1.py b/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/lookup/lookup1.py new file mode 100644 index 00000000..e274f19f --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/lookup/lookup1.py @@ -0,0 +1,28 @@ +# 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 = """ + name: lookup1 + author: Ansible Core Team + short_description: hello test lookup + description: + - Hello test lookup. + options: {} +""" + +EXAMPLES = """ +- minimal: +""" + +RETURN = """ +""" + +from ansible.plugins.lookup import LookupBase + + +class LookupModule(LookupBase): + + def run(self, terms, variables=None, **kwargs): + return [] diff --git a/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/modules/a/b/module2.py b/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/modules/a/b/module2.py new file mode 100644 index 00000000..6fafa193 --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/modules/a/b/module2.py @@ -0,0 +1,34 @@ +#!/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: module2 +short_description: Hello test module +description: Hello test module. +options: {} +author: + - Ansible Core Team +''' + +EXAMPLES = ''' +- minimal: +''' + +RETURN = '''''' + +from ansible.module_utils.basic import AnsibleModule + + +def main(): + module = AnsibleModule( + argument_spec={}, + ) + + module.exit_json() + + +if __name__ == '__main__': + main() diff --git a/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/modules/module1.py b/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/modules/module1.py new file mode 100644 index 00000000..8847f5b8 --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-ansible-doc/ansible_collections/ns/col/plugins/modules/module1.py @@ -0,0 +1,34 @@ +#!/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: module1 +short_description: Hello test module +description: Hello test module. +options: {} +author: + - Ansible Core Team +''' + +EXAMPLES = ''' +- minimal: +''' + +RETURN = '''''' + +from ansible.module_utils.basic import AnsibleModule + + +def main(): + module = AnsibleModule( + argument_spec={}, + ) + + module.exit_json() + + +if __name__ == '__main__': + main() diff --git a/test/integration/targets/ansible-test-sanity-ansible-doc/runme.sh b/test/integration/targets/ansible-test-sanity-ansible-doc/runme.sh new file mode 100755 index 00000000..ee1a8823 --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-ansible-doc/runme.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -eu + +source ../collection/setup.sh + +set -x + +ansible-test sanity --test ansible-doc --color "${@}" diff --git a/test/integration/targets/apt/tasks/apt.yml b/test/integration/targets/apt/tasks/apt.yml index 5b1a24a3..d273eda7 100644 --- a/test/integration/targets/apt/tasks/apt.yml +++ b/test/integration/targets/apt/tasks/apt.yml @@ -83,12 +83,26 @@ - apt_install_fnmatch is changed - apt_uninstall_fnmatch is changed +- name: Test update_cache 1 (check mode) + apt: + update_cache: true + cache_valid_time: 10 + register: apt_update_cache_1_check_mode + check_mode: true + - name: Test update_cache 1 apt: update_cache: true cache_valid_time: 10 register: apt_update_cache_1 +- name: Test update_cache 2 (check mode) + apt: + update_cache: true + cache_valid_time: 10 + register: apt_update_cache_2_check_mode + check_mode: true + - name: Test update_cache 2 apt: update_cache: true @@ -98,7 +112,9 @@ - name: verify update_cache assert: that: + - apt_update_cache_1_check_mode is changed - apt_update_cache_1 is changed + - apt_update_cache_2_check_mode is not changed - apt_update_cache_2 is not changed - name: uninstall apt bindings with apt again diff --git a/test/integration/targets/apt/tasks/repo.yml b/test/integration/targets/apt/tasks/repo.yml index 1705cb3e..e4e39aa3 100644 --- a/test/integration/targets/apt/tasks/repo.yml +++ b/test/integration/targets/apt/tasks/repo.yml @@ -40,6 +40,17 @@ state: absent allow_unauthenticated: yes +- name: Try to install non-existent version + apt: + name: foo=99 + state: present + ignore_errors: true + register: apt_result + +- name: Check if install failed + assert: + that: + - apt_result is failed # https://github.com/ansible/ansible/issues/30638 - block: @@ -56,6 +67,7 @@ assert: that: - "apt_result is not changed" + - "apt_result is failed" - apt: name: foo=1.0.0 @@ -122,12 +134,58 @@ - item.item.3 is none or "Inst foo [1.0.0] (" + item.item.3 + " localhost [all])" in item.stdout_lines loop: '{{ apt_result.results }}' + - name: Pin foo=1.0.0 + copy: + content: |- + Package: foo + Pin: version 1.0.0 + Pin-Priority: 1000 + dest: /etc/apt/preferences.d/foo + + - name: Run pinning version test matrix + apt: + name: foo{{ item.0 }} + default_release: '{{ item.1 }}' + state: '{{ item.2 | ternary("latest","present") }}' + check_mode: true + ignore_errors: true + register: apt_result + loop: + # [filter, release, state_latest, expected] # expected=null for no change. expected=False to assert an error + - ["", null, false, null] + - ["", null, true, null] + - ["=1.0.0", null, false, null] + - ["=1.0.0", null, true, null] + - ["=1.0.1", null, false, "1.0.1"] + #- ["=1.0.*", null, false, null] # legacy behavior. should not upgrade without state=latest + - ["=1.0.*", null, true, "1.0.1"] + - [">=1.0.0", null, false, null] + - [">=1.0.0", null, true, null] + - [">=1.0.1", null, false, False] + - ["", "testing", false, null] + - ["", "testing", true, null] + - ["=2.0.0", null, false, "2.0.0"] + - [">=2.0.0", "testing", false, False] + + - name: Validate pinning version test matrix + assert: + that: + - (item.item.3 != False) or (item.item.3 == False and item is failed) + - (item.item.3 is string) == (item.stdout is defined) + - item.item.3 is not string or "Inst foo [1.0.0] (" + item.item.3 + " localhost [all])" in item.stdout_lines + loop: '{{ apt_result.results }}' + always: - name: Uninstall foo apt: name: foo state: absent + - name: Unpin foo + file: + path: /etc/apt/preferences.d/foo + state: absent + # https://github.com/ansible/ansible/issues/35900 - block: - name: Disable ubuntu repos so system packages are not upgraded and do not change testing env @@ -138,6 +196,42 @@ name: foobar=1.0.0 allow_unauthenticated: yes + - name: mark foobar as auto for next test + shell: apt-mark auto foobar + + - name: Install foobar (marked as manual) (check mode) + apt: + name: foobar=1.0.1 + allow_unauthenticated: yes + check_mode: yes + register: manual_foobar_install_check_mode + + - name: check foobar was not marked as manually installed by check mode + shell: apt-mark showmanual | grep foobar + ignore_errors: yes + register: showmanual + + - assert: + that: + - manual_foobar_install_check_mode.changed + - "'foobar' not in showmanual.stdout" + + - name: Install foobar (marked as manual) + apt: + name: foobar=1.0.1 + allow_unauthenticated: yes + register: manual_foobar_install + + - name: check foobar was marked as manually installed + shell: apt-mark showmanual | grep foobar + ignore_errors: yes + register: showmanual + + - assert: + that: + - manual_foobar_install.changed + - "'foobar' in showmanual.stdout" + - name: Upgrade foobar to a version which does not depend on foo, autoremove should remove foo apt: upgrade: dist diff --git a/test/integration/targets/connection_paramiko_ssh/aliases b/test/integration/targets/connection_paramiko_ssh/aliases index aa7fd949..c5793217 100644 --- a/test/integration/targets/connection_paramiko_ssh/aliases +++ b/test/integration/targets/connection_paramiko_ssh/aliases @@ -2,4 +2,5 @@ needs/ssh shippable/posix/group3 needs/target/setup_paramiko needs/target/connection +skip/freebsd/13.0 # bcrypt 4+ requires a newer version of rust than is available destructive # potentially installs/uninstalls OS packages via setup_paramiko diff --git a/test/integration/targets/file/tasks/main.yml b/test/integration/targets/file/tasks/main.yml index a74cbc28..4ad19e06 100644 --- a/test/integration/targets/file/tasks/main.yml +++ b/test/integration/targets/file/tasks/main.yml @@ -151,8 +151,10 @@ attributes_supported: yes when: - attribute_A_set is success + - attribute_A_set.stdout_lines - "'A' in attribute_A_set.stdout_lines[0].split()[0]" - attribute_A_unset is success + - attribute_A_unset.stdout_lines - "'A' not in attribute_A_unset.stdout_lines[0].split()[0]" - name: explicitly set file attribute "A" diff --git a/test/integration/targets/incidental_inventory_aws_ec2/playbooks/setup.yml b/test/integration/targets/incidental_inventory_aws_ec2/playbooks/setup.yml index 8a9b8893..d12d300f 100644 --- a/test/integration/targets/incidental_inventory_aws_ec2/playbooks/setup.yml +++ b/test/integration/targets/incidental_inventory_aws_ec2/playbooks/setup.yml @@ -14,7 +14,7 @@ owner-id: '125523088429' virtualization-type: hvm root-device-type: ebs - name: 'Fedora-Atomic-27*' + name: 'Fedora-Cloud-Base-*' <<: *aws_connection_info register: fedora_images diff --git a/test/integration/targets/wait_for/files/write_utf16.py b/test/integration/targets/wait_for/files/write_utf16.py new file mode 100644 index 00000000..6079ed33 --- /dev/null +++ b/test/integration/targets/wait_for/files/write_utf16.py @@ -0,0 +1,20 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import sys + +# utf16 encoded bytes +# to ensure wait_for doesn't have any encoding errors +data = ( + b'\xff\xfep\x00r\x00e\x00m\x00i\x00\xe8\x00r\x00e\x00 \x00i\x00s\x00 ' + b'\x00f\x00i\x00r\x00s\x00t\x00\n\x00p\x00r\x00e\x00m\x00i\x00e\x00' + b'\x00\x03r\x00e\x00 \x00i\x00s\x00 \x00s\x00l\x00i\x00g\x00h\x00t\x00' + b'l\x00y\x00 \x00d\x00i\x00f\x00f\x00e\x00r\x00e\x00n\x00t\x00\n\x00\x1a' + b'\x048\x04@\x048\x04;\x04;\x048\x04F\x040\x04 \x00i\x00s\x00 \x00C\x00y' + b'\x00r\x00i\x00l\x00l\x00i\x00c\x00\n\x00\x01\xd8\x00\xdc \x00a\x00m' + b'\x00 \x00D\x00e\x00s\x00e\x00r\x00e\x00t\x00\n\x00\n' + b'completed\n' +) + +with open(sys.argv[1], 'wb') as f: + f.write(data) diff --git a/test/integration/targets/wait_for/tasks/main.yml b/test/integration/targets/wait_for/tasks/main.yml index c524f990..f71ddbda 100644 --- a/test/integration/targets/wait_for/tasks/main.yml +++ b/test/integration/targets/wait_for/tasks/main.yml @@ -104,6 +104,16 @@ - waitfor['match_groupdict']['foo'] == 'data' - waitfor['match_groups'] == ['data', '123'] +- name: write non-ascii file + script: write_utf16.py "{{remote_tmp_dir}}/utf16.txt" + args: + executable: '{{ ansible_facts.python.executable }}' + +- name: test non-ascii file + wait_for: + path: "{{remote_tmp_dir}}/utf16.txt" + search_regex: completed + - name: test wait for port timeout wait_for: port: 12121 diff --git a/test/lib/ansible_test/_data/requirements/sanity.mypy.in b/test/lib/ansible_test/_data/requirements/sanity.mypy.in index b7b82297..890caf30 100644 --- a/test/lib/ansible_test/_data/requirements/sanity.mypy.in +++ b/test/lib/ansible_test/_data/requirements/sanity.mypy.in @@ -2,8 +2,9 @@ mypy[python2] packaging # type stubs not published separately types-backports types-jinja2 -types-paramiko +types-paramiko < 2.8.14 # newer versions drop support for Python 2.7 types-pyyaml < 6 # PyYAML 6+ stubs do not support Python 2.7 +types-cryptography < 3.3.16 # newer versions drop support for Python 2.7 types-requests types-setuptools types-toml diff --git a/test/lib/ansible_test/_data/requirements/sanity.mypy.txt b/test/lib/ansible_test/_data/requirements/sanity.mypy.txt index d4baf563..e448c907 100644 --- a/test/lib/ansible_test/_data/requirements/sanity.mypy.txt +++ b/test/lib/ansible_test/_data/requirements/sanity.mypy.txt @@ -1,10 +1,10 @@ # edit "sanity.mypy.in" and generate with: hacking/update-sanity-requirements.py --test mypy -mypy==0.931 +mypy==0.950 mypy-extensions==0.4.3 packaging==21.2 pyparsing==2.4.7 tomli==2.0.1 -typed-ast==1.5.2 +typed-ast==1.5.3 types-backports==0.1.3 types-cryptography==3.3.15 types-enum34==1.1.8 @@ -13,8 +13,8 @@ types-Jinja2==2.11.9 types-MarkupSafe==1.1.10 types-paramiko==2.8.13 types-PyYAML==5.4.12 -types-requests==2.27.10 -types-setuptools==57.4.9 -types-toml==0.10.4 -types-urllib3==1.26.9 +types-requests==2.27.25 +types-setuptools==57.4.14 +types-toml==0.10.6 +types-urllib3==1.26.14 typing-extensions==3.10.0.2 diff --git a/test/lib/ansible_test/_internal/classification/__init__.py b/test/lib/ansible_test/_internal/classification/__init__.py index 7a7e918b..c599d36e 100644 --- a/test/lib/ansible_test/_internal/classification/__init__.py +++ b/test/lib/ansible_test/_internal/classification/__init__.py @@ -746,13 +746,13 @@ class PathMapper: if path.startswith('test/lib/ansible_test/_internal/commands/sanity/'): return { 'sanity': 'all', # test infrastructure, run all sanity checks - 'integration': 'ansible-test', # run ansible-test self tests + 'integration': 'ansible-test/', # run ansible-test self tests } if path.startswith('test/lib/ansible_test/_internal/commands/units/'): return { 'units': 'all', # test infrastructure, run all unit tests - 'integration': 'ansible-test', # run ansible-test self tests + 'integration': 'ansible-test/', # run ansible-test self tests } if path.startswith('test/lib/ansible_test/_data/requirements/'): @@ -776,13 +776,13 @@ class PathMapper: if path.startswith('test/lib/ansible_test/_util/controller/sanity/') or path.startswith('test/lib/ansible_test/_util/target/sanity/'): return { 'sanity': 'all', # test infrastructure, run all sanity checks - 'integration': 'ansible-test', # run ansible-test self tests + 'integration': 'ansible-test/', # run ansible-test self tests } if path.startswith('test/lib/ansible_test/_util/target/pytest/'): return { 'units': 'all', # test infrastructure, run all unit tests - 'integration': 'ansible-test', # run ansible-test self tests + 'integration': 'ansible-test/', # run ansible-test self tests } if path.startswith('test/lib/'): diff --git a/test/lib/ansible_test/_internal/commands/sanity/ansible_doc.py b/test/lib/ansible_test/_internal/commands/sanity/ansible_doc.py index 0b421ed3..47ed1eb5 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/ansible_doc.py +++ b/test/lib/ansible_test/_internal/commands/sanity/ansible_doc.py @@ -65,7 +65,6 @@ class AnsibleDocTest(SanitySingleVersion): paths = [target.path for target in targets.include] doc_targets = collections.defaultdict(list) # type: t.Dict[str, t.List[str]] - target_paths = collections.defaultdict(dict) # type: t.Dict[str, t.Dict[str, str]] remap_types = dict( modules='module', @@ -75,13 +74,15 @@ class AnsibleDocTest(SanitySingleVersion): plugin_type = remap_types.get(plugin_type, plugin_type) for plugin_file_path in [target.name for target in targets.include if is_subdir(target.path, plugin_path)]: - plugin_name = os.path.splitext(os.path.basename(plugin_file_path))[0] + plugin_parts = os.path.relpath(plugin_file_path, plugin_path).split(os.path.sep) + plugin_name = os.path.splitext(plugin_parts[-1])[0] if plugin_name.startswith('_'): plugin_name = plugin_name[1:] - doc_targets[plugin_type].append(data_context().content.prefix + plugin_name) - target_paths[plugin_type][data_context().content.prefix + plugin_name] = plugin_file_path + plugin_fqcn = data_context().content.prefix + '.'.join(plugin_parts[:-1] + [plugin_name]) + + doc_targets[plugin_type].append(plugin_fqcn) env = ansible_environment(args, color=False) error_messages = [] # type: t.List[SanityMessage] diff --git a/test/lib/ansible_test/_internal/commands/sanity/mypy.py b/test/lib/ansible_test/_internal/commands/sanity/mypy.py index 5b83aa8b..fe664ddc 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/mypy.py +++ b/test/lib/ansible_test/_internal/commands/sanity/mypy.py @@ -90,11 +90,22 @@ class MypyTest(SanityMultipleVersion): display.warning(f'Skipping sanity test "{self.name}" due to missing virtual environment support on Python {args.controller_python.version}.') return SanitySkipped(self.name, python.version) + # Temporary hack to make Python 3.8 a remote-only Python version since we'll be dropping controller support for it soon. + # This avoids having to change annotations or add ignores for issues that are specific to that version. + + change_version = '3.8' + + if change_version not in CONTROLLER_PYTHON_VERSIONS or change_version in REMOTE_ONLY_PYTHON_VERSIONS: + raise Exception(f'Remove this hack now that Python {change_version} is not supported by the controller.') + + controller_python_versions = tuple(version for version in CONTROLLER_PYTHON_VERSIONS if version != change_version) + remote_only_python_versions = REMOTE_ONLY_PYTHON_VERSIONS + (change_version,) + contexts = ( - MyPyContext('ansible-test', ['test/lib/ansible_test/_util/target/sanity/import/'], CONTROLLER_PYTHON_VERSIONS), - MyPyContext('ansible-test', ['test/lib/ansible_test/_internal/'], CONTROLLER_PYTHON_VERSIONS), - MyPyContext('ansible-core', ['lib/ansible/'], CONTROLLER_PYTHON_VERSIONS), - MyPyContext('modules', ['lib/ansible/modules/', 'lib/ansible/module_utils/'], REMOTE_ONLY_PYTHON_VERSIONS), + MyPyContext('ansible-test', ['test/lib/ansible_test/_util/target/sanity/import/'], controller_python_versions), + MyPyContext('ansible-test', ['test/lib/ansible_test/_internal/'], controller_python_versions), + MyPyContext('ansible-core', ['lib/ansible/'], controller_python_versions), + MyPyContext('modules', ['lib/ansible/modules/', 'lib/ansible/module_utils/'], remote_only_python_versions), ) unfiltered_messages = [] # type: t.List[SanityMessage] diff --git a/test/lib/ansible_test/_internal/target.py b/test/lib/ansible_test/_internal/target.py index 879a7944..3962b95f 100644 --- a/test/lib/ansible_test/_internal/target.py +++ b/test/lib/ansible_test/_internal/target.py @@ -611,6 +611,9 @@ class IntegrationTarget(CompletionTarget): groups += [a for a in static_aliases if a not in modules] groups += ['module/%s' % m for m in self.modules] + if data_context().content.is_ansible and (self.name == 'ansible-test' or self.name.startswith('ansible-test-')): + groups.append('ansible-test') + if not self.modules: groups.append('non_module') diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 0d2bb352..9f4b55d8 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -252,6 +252,7 @@ lib/ansible/module_utils/six/__init__.py mypy-2.7:assignment # vendored code lib/ansible/module_utils/six/__init__.py mypy-3.5:assignment # vendored code lib/ansible/module_utils/six/__init__.py mypy-3.6:assignment # vendored code lib/ansible/module_utils/six/__init__.py mypy-3.7:assignment # vendored code +lib/ansible/module_utils/six/__init__.py mypy-3.8:assignment # vendored code lib/ansible/module_utils/six/__init__.py mypy-2.7:misc # vendored code lib/ansible/module_utils/six/__init__.py mypy-3.5:misc # vendored code lib/ansible/module_utils/six/__init__.py mypy-3.6:misc # vendored code diff --git a/test/units/executor/test_task_executor.py b/test/units/executor/test_task_executor.py index 003cedee..f7162978 100644 --- a/test/units/executor/test_task_executor.py +++ b/test/units/executor/test_task_executor.py @@ -334,6 +334,8 @@ class TestTaskExecutor(unittest.TestCase): mock_play_context.update_vars.return_value = None mock_connection = MagicMock() + mock_connection.force_persistence = False + mock_connection.supports_persistence = False mock_connection.set_host_overrides.return_value = None mock_connection._connect.return_value = None diff --git a/test/units/inventory/__init__.py b/test/units/inventory/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/units/inventory/__init__.py |