Update ansible test splitter with indirect node count targets#192
Update ansible test splitter with indirect node count targets#192brahmanim wants to merge 3 commits intoansible-network:mainfrom
Conversation
| self._my_test_plan.append(t) | ||
|
|
||
| def add_targets_to_plan_from_aliases_or_prefix_name( | ||
| self, alias_line: str = "", prefix_name: str = "" |
There was a problem hiding this comment.
| self, alias_line: str = "", prefix_name: str = "" | |
| self, alias_line: Optional[str] = None, prefix_name: Optional[str] = None |
If you set "" as default value, the expression t.name.startswith(prefix_name) will always be true when using the default value.
There was a problem hiding this comment.
Update the default values to Optional[str] = None
| continue | ||
| # Add the target to the plan if either the name starts with `prefix_name` or | ||
| # The aliases file contains the line `alias_line` | ||
| if t.is_alias_of(alias_line) or t.name.startswith(prefix_name): |
There was a problem hiding this comment.
| if t.is_alias_of(alias_line) or t.name.startswith(prefix_name): | |
| if (alias_line and t.is_alias_of(alias_line)) or (prefix_name and t.name.startswith(prefix_name)): |
| if whc.extensions_audit_event_query(): | ||
| for collection in collections: | ||
| collection.add_indirect_node_count_targets_to_plan() |
There was a problem hiding this comment.
This code line is not true. In case of cross-collection testing (which is the case for amazon.aws with community.aws), here we are triggering all the indirect node count targets for all collections when the file is updated in one of the impacted collections.
There was a problem hiding this comment.
Add a condition for adding indirect node count targets only to the updated collection.
|
@brahmanim You will need to perform your changes into the |
44f20ea to
2a09d8d
Compare
|
Hi @abikouo, I will perform my changes to the |
This PR introduces a new ability to trigger indirect node count targets by ansible_test_splitter based on the following logic:
This action reads elements to test from the
extensions\auditdirectory and corresponding tests from thetests/integration/targetsdirectory. Here are more details on the relationship betweenextensions\auditand integration test targets:node_query_or define theindirect_node_countline in thealiasesfile, when theevent_query.ymlfile changes.This PR also fixes a pre-commit issue:
.github/actions/ansible_test_splitter/list_changed_targets.py:63:4: R0912: Too many branches (14/12) (too-many-branches)