Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions monitoring/uss_qualifier/action_generators/action_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ def get_name(cls) -> str:
"""
return cls.__name__

def get_resources_provided(self) -> list[ResourceID] | None:
"""Return IDs of resources supplied to generated actions, if known.

IDs are unique, in first-seen order, in this generator's resource
namespace before child action resource mappings. This describes resources
supplied while constructing actions, including actions that may subsequently
be skipped. Return None when this information is unavailable.
"""
return None

@staticmethod
def make_from_definition(
definition: ActionGeneratorDefinition, resources: dict[ResourceID, ResourceType]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ResourceEnvironmentsActionGenerator(
):
_actions: list[TestSuiteAction]
_current_action: int
_resources_provided: list[ResourceID]

@classmethod
def list_potential_actions(
Expand Down Expand Up @@ -67,14 +68,20 @@ def __init__(
)

self._actions = []
resources_provided: dict[ResourceID, None] = {}
for resource_env in environments_source.get_environments():
resources_provided.update(dict.fromkeys(resource_env))
modified_resources = resources | resource_env

self._actions.append(
TestSuiteAction(specification.action_to_repeat, modified_resources)
)

self._resources_provided = list(resources_provided)
self._current_action = 0

def actions(self) -> Iterator[TestSuiteAction]:
yield from self._actions

def get_resources_provided(self) -> list[ResourceID]:
return self._resources_provided.copy()
7 changes: 7 additions & 0 deletions monitoring/uss_qualifier/reports/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ class ActionGeneratorReport(ImplicitDict):
generator_type: GeneratorTypeName
"""Type of action generator"""

resources_provided: Optional[list[ResourceID]]
"""Resource IDs supplied while constructing generated actions, in the generator's resource namespace before child action resource mappings.

Each ID occurs once, in first-seen order. Different generated actions may have different resources available.
Includes resources for actions that may subsequently be skipped. An empty list means no resources were supplied; absent when unknown.
"""

start_time: StringBasedDateTime
"""Time at which the action generator started"""

Expand Down
12 changes: 11 additions & 1 deletion monitoring/uss_qualifier/reports/sequence_view/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,18 @@ def compute_action_node(report: TestSuiteActionReport, indexer: Indexer) -> Acti
generator_type = action_generator_type_from_name(
report.action_generator.generator_type
)
name = generator_type.get_name()
resource_ids = report.action_generator.resources_provided
if resource_ids:
if len(resource_ids) > 2:
resource_list = (
", ".join(resource_ids[:-1]) + ", and " + resource_ids[-1]
)
else:
resource_list = " and ".join(resource_ids)
name += f" supplying {resource_list}"
return ActionNode(
name=generator_type.get_name(),
name=name,
node_type=ActionNodeType.ActionGenerator,
children=[
compute_action_node(a, indexer) for a in report.action_generator.actions
Expand Down
4 changes: 4 additions & 0 deletions monitoring/uss_qualifier/suites/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ def _run_action_generator(self, context: ExecutionContext) -> ActionGeneratorRep

_run_actions(self.action_generator.actions(), context, report)

resources_provided = self.action_generator.get_resources_provided()
if resources_provided is not None:
report.resources_provided = resources_provided

return report


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
"description": "Type of action generator",
"type": "string"
},
"resources_provided": {
"description": "Resource IDs supplied while constructing generated actions, in the generator's resource namespace before child action resource mappings.\n\nEach ID occurs once, in first-seen order. Different generated actions may have different resources available.\nIncludes resources for actions that may subsequently be skipped. An empty list means no resources were supplied; absent when unknown.",
"items": {
"type": "string"
},
"type": [
"array",
"null"
]
},
"start_time": {
"description": "Time at which the action generator started",
"format": "date-time",
Expand Down
Loading