From 9ec6e331bf13896e05a11677a4dece14b5136d4d Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 15 Aug 2022 14:47:30 -0700 Subject: [PATCH] [stable-2.13] ansible-test - Fix self-test change handling. (#78521) (#78523) (cherry picked from commit 99016653a29cc2c1c5aa05324ed92dabf5e9f1fc) --- .../fragments/ansible-test-self-change-classification.yml | 2 ++ .../lib/ansible_test/_internal/classification/__init__.py | 8 ++++---- test/lib/ansible_test/_internal/target.py | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/ansible-test-self-change-classification.yml diff --git a/changelogs/fragments/ansible-test-self-change-classification.yml b/changelogs/fragments/ansible-test-self-change-classification.yml new file mode 100644 index 00000000000..70970b4540e --- /dev/null +++ b/changelogs/fragments/ansible-test-self-change-classification.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - Fix change detection for ansible-test's own integration tests. diff --git a/test/lib/ansible_test/_internal/classification/__init__.py b/test/lib/ansible_test/_internal/classification/__init__.py index 7a7e918b8d0..c599d36edf0 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/target.py b/test/lib/ansible_test/_internal/target.py index 879a7944ec6..3962b95f3b9 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')