diff options
author | Matt Clay <matt@mystile.com> | 2023-02-28 13:21:11 -0800 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2023-03-14 17:47:58 -0700 |
commit | 4461de15deed01cf05486027ac1cf250c51e3dd5 (patch) | |
tree | ec14143392d3cb363c7e4f06addc3eb6a468aee4 /test/lib/ansible_test/_internal/classification/__init__.py | |
parent | bea9a2acf72f87661660a0d46c8554777aa02978 (diff) | |
download | ansible-4461de15deed01cf05486027ac1cf250c51e3dd5.tar.gz |
[stable-2.14] Relocate the AZP entry point scripts (#80114)
Scripts previously under `test/utils/shippable/` are now under `.azure-pipelines/commands/` instead.
(cherry picked from commit f47bc03599eedc48753d2cd5e1bea177f35e6133)
Co-authored-by: Matt Clay <matt@mystile.com>
Diffstat (limited to 'test/lib/ansible_test/_internal/classification/__init__.py')
-rw-r--r-- | test/lib/ansible_test/_internal/classification/__init__.py | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/test/lib/ansible_test/_internal/classification/__init__.py b/test/lib/ansible_test/_internal/classification/__init__.py index 5c7009488a..3cf6044e52 100644 --- a/test/lib/ansible_test/_internal/classification/__init__.py +++ b/test/lib/ansible_test/_internal/classification/__init__.py @@ -662,21 +662,54 @@ class PathMapper: def _classify_ansible(self, path: str) -> t.Optional[dict[str, str]]: """Return the classification for the given path using rules specific to Ansible.""" + dirname = os.path.dirname(path) + filename = os.path.basename(path) + name, ext = os.path.splitext(filename) + + minimal: dict[str, str] = {} + + # Early classification that needs to occur before common classification belongs here. + if path.startswith('test/units/compat/'): return { 'units': 'test/units/', } + if dirname == '.azure-pipelines/commands': + test_map = { + 'cloud.sh': 'integration:cloud/', + 'linux.sh': 'integration:all', + 'network.sh': 'network-integration:all', + 'remote.sh': 'integration:all', + 'sanity.sh': 'sanity:all', + 'units.sh': 'units:all', + 'windows.sh': 'windows-integration:all', + } + + test_match = test_map.get(filename) + + if test_match: + test_command, test_target = test_match.split(':') + + return { + test_command: test_target, + } + + cloud_target = f'cloud/{name}/' + + if cloud_target in self.integration_targets_by_alias: + return { + 'integration': cloud_target, + } + + # Classification common to both ansible and collections. + result = self._classify_common(path) if result is not None: return result - dirname = os.path.dirname(path) - filename = os.path.basename(path) - name, ext = os.path.splitext(filename) - - minimal: dict[str, str] = {} + # Classification here is specific to ansible, and runs after common classification. if path.startswith('bin/'): return all_tests(self.args) # broad impact, run all tests @@ -792,39 +825,6 @@ class PathMapper: if path.startswith('test/support/'): return all_tests(self.args) # test infrastructure, run all tests - if path.startswith('test/utils/shippable/'): - if dirname == 'test/utils/shippable': - test_map = { - 'cloud.sh': 'integration:cloud/', - 'linux.sh': 'integration:all', - 'network.sh': 'network-integration:all', - 'remote.sh': 'integration:all', - 'sanity.sh': 'sanity:all', - 'units.sh': 'units:all', - 'windows.sh': 'windows-integration:all', - } - - test_match = test_map.get(filename) - - if test_match: - test_command, test_target = test_match.split(':') - - return { - test_command: test_target, - } - - cloud_target = 'cloud/%s/' % name - - if cloud_target in self.integration_targets_by_alias: - return { - 'integration': cloud_target, - } - - return all_tests(self.args) # test infrastructure, run all tests - - if path.startswith('test/utils/'): - return minimal - if '/' not in path: if path in ( '.gitattributes', |