summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py')
-rw-r--r--test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py b/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py
index 3ff9895988..bc96b684f8 100644
--- a/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py
+++ b/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py
@@ -1,6 +1,7 @@
"""Sanity test to check integration test aliases."""
from __future__ import annotations
+import dataclasses
import json
import textwrap
import os
@@ -128,7 +129,7 @@ class IntegrationAliasesTest(SanitySingleVersion):
def ci_test_groups(self): # type: () -> t.Dict[str, t.List[int]]
"""Return a dictionary of CI test names and their group(s)."""
if not self._ci_test_groups:
- test_groups = {}
+ test_groups = {} # type: t.Dict[str, t.Set[int]]
for stage in self._ci_config['stages']:
for job in stage['jobs']:
@@ -210,7 +211,7 @@ class IntegrationAliasesTest(SanitySingleVersion):
path=self.CI_YML,
)])
- results = dict(
+ results = Results(
comments=[],
labels={},
)
@@ -218,7 +219,7 @@ class IntegrationAliasesTest(SanitySingleVersion):
self.load_ci_config(python)
self.check_changes(args, results)
- write_json_test_results(ResultType.BOT, 'data-sanity-ci.json', results)
+ write_json_test_results(ResultType.BOT, 'data-sanity-ci.json', results.__dict__)
messages = []
@@ -318,6 +319,9 @@ class IntegrationAliasesTest(SanitySingleVersion):
messages = []
for path in unassigned_paths:
+ if path == 'test/integration/targets/ansible-test-container':
+ continue # special test target which uses group 6 -- nothing else should be in that group
+
messages.append(SanityMessage(unassigned_message, '%s/aliases' % path))
for path in conflicting_paths:
@@ -325,8 +329,8 @@ class IntegrationAliasesTest(SanitySingleVersion):
return messages
- def check_changes(self, args, results): # type: (SanityConfig, t.Dict[str, t.Any]) -> None
- """Check changes and store results in the provided results dictionary."""
+ def check_changes(self, args, results): # type: (SanityConfig, Results) -> None
+ """Check changes and store results in the provided result dictionary."""
integration_targets = list(walk_integration_targets())
module_targets = list(walk_module_targets())
@@ -370,8 +374,8 @@ class IntegrationAliasesTest(SanitySingleVersion):
unsupported_tests=bool(unsupported_targets),
)
- results['comments'] += comments
- results['labels'].update(labels)
+ results.comments += comments
+ results.labels.update(labels)
def format_comment(self, template, targets): # type: (str, t.List[str]) -> t.Optional[str]
"""Format and return a comment based on the given template and targets, or None if there are no targets."""
@@ -388,3 +392,10 @@ class IntegrationAliasesTest(SanitySingleVersion):
message = textwrap.dedent(template).strip().format(**data)
return message
+
+
+@dataclasses.dataclass
+class Results:
+ """Check results."""
+ comments: t.List[str]
+ labels: t.Dict[str, bool]