Skip to content

Commit

Permalink
[uss_qualifier] Include whole config in report (#453)
Browse files Browse the repository at this point in the history
* Include whole config in report

* Improve configuration display in sequence_view
  • Loading branch information
BenjaminPelletier authored Dec 29, 2023
1 parent dd164f7 commit 46f89bc
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion monitoring/uss_qualifier/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def execute_test_run(whole_config: USSQualifierConfiguration):
commit_hash=commit_hash,
baseline_signature=baseline_signature,
environment_signature=environment_signature,
configuration=config,
configuration=whole_config,
report=report,
)

Expand Down
4 changes: 2 additions & 2 deletions monitoring/uss_qualifier/reports/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from monitoring.uss_qualifier.action_generators.definitions import GeneratorTypeName
from monitoring.uss_qualifier.common_data_definitions import Severity
from monitoring.uss_qualifier.configurations.configuration import (
TestConfiguration,
ParticipantID,
USSQualifierConfiguration,
)
from monitoring.uss_qualifier.fileio import FileReference
from monitoring.uss_qualifier.reports.capability_definitions import (
Expand Down Expand Up @@ -732,7 +732,7 @@ class TestRunReport(ImplicitDict):
environment_signature: str
"""Signature of the environmental inputs of the configuration not included in the baseline signature."""

configuration: TestConfiguration
configuration: USSQualifierConfiguration
"""Configuration used to run uss_qualifier"""

report: TestSuiteActionReport
Expand Down
32 changes: 32 additions & 0 deletions monitoring/uss_qualifier/reports/sequence_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,42 @@ def _generate_scenario_pages(
_generate_scenario_pages(child, config, output_path)


def _make_resources_config(config: TestConfiguration) -> dict:
baseline = {}
environment = {}
non_baseline_inputs = (
config.non_baseline_inputs
if "non_baseline_inputs" in config and config.non_baseline_inputs
else []
)
for resource_id, resource_dec in config.resources.resource_declarations.items():
value = {"Specification": resource_dec.specification}
if "dependencies" in resource_dec and resource_dec.dependencies:
value["Dependencies"] = {
f"<code>{local_name}</code>": f"From <code>{source_name}</code> resource"
for local_name, source_name in resource_dec.dependencies.items()
}
key = f"<code>{resource_id}</code> ({resource_dec.resource_type})"
current_address = "v1.test_run.resources.resource_declarations." + resource_id
if current_address in non_baseline_inputs:
environment[key] = value
else:
baseline[key] = value
result = {}
if baseline:
result["Baseline"] = baseline
if environment:
result["Environment"] = environment
return result


def generate_sequence_view(
report: TestRunReport, config: SequenceViewConfiguration, output_path: str
) -> None:
node = _compute_action_node(report.report, Indexer())

resources_config = _make_resources_config(report.configuration.v1.test_run)

os.makedirs(output_path, exist_ok=True)
_generate_scenario_pages(node, config, output_path)

Expand All @@ -653,6 +684,7 @@ def generate_sequence_view(
f.write(
template.render(
report=report,
resources_config=resources_config,
test_run=compute_test_run_information(report),
overview_rows=overview_rows,
max_suite_cols=max_suite_cols,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,19 @@ <h1>Sequence view of uss_qualifier test run</h1>
</div>
</div>

<div id="configuration_section" class="collapseable">
<div class="node_key" onclick="showHide(document.getElementById('configuration_section'))"><h2>Resources configuration</h2></div>
<div id="resources_configuration_section" class="collapseable">
<div class="node_key" onclick="showHide(document.getElementById('resources_configuration_section'))"><h2>Resources configuration</h2></div>
<div class="node_value">
{% for is_baseline in (True, False) %}
<h3>{{ "Baseline" if is_baseline else "Environment" }}</h3>
<ul>
{% set current = namespace(address="v1.test_run.resources.resource_declarations") %}
{% for resource_id, resource_dec in report.configuration.resources.resource_declarations.items() %}
{% set current.address = current.address + "." + resource_id %}
{% if ("non_baseline_inputs" in report.configuration and report.configuration.non_baseline_inputs and (current.address in report.configuration.non_baseline_inputs) != is_baseline) or (("non_baseline_inputs" not in report.configuration or not report.configuration.non_baseline_inputs) and is_baseline) %}
<li id="resource_{{ resource_id }}"><code>{{ resource_id }}</code> ({{ resource_dec.resource_type }})
<ul>
{% if resource_dec.dependencies %}
{% for local_name, source_name in resource_dec.dependencies.items() %}
<li><code>{{ local_name }}</code>: From <a href="#resource_{{ source_name }}"><code>{{ source_name }}</code> resource</a></li>
{% endfor %}
{% endif %}
<li>Specification:
{% set spec_id = "specification_" + resource_id %}
{{ explorer_content(spec_id, resource_dec.specification) }}
{% set collapsible.queries = collapsible.queries + [spec_id] %}
</li>
</ul>
</li>
{% endif %}
{% set current.address = ".".join(current.address.split(".")[0:-1]) %}
{% endfor %}
</ul>
{% endfor %}
{{ explorer_content("resources_configuration_tree", resources_config) }}
{% set collapsible.queries = collapsible.queries + ["resources_configuration_tree"] %}
</div>
</div>

<div id="full_configuration_section" class="collapseable">
<div class="node_key" onclick="showHide(document.getElementById('full_configuration_section'))"><h2>Full configuration</h2></div>
<div class="node_value">
{{ explorer_content("full_configuration_tree", report.configuration) }}
{% set collapsible.queries = collapsible.queries + ["full_configuration_tree"] %}
</div>
</div>

Expand Down Expand Up @@ -160,7 +144,8 @@ <h2>Scenarios executed</h2>
</div>
{{ explorer_footer(collapsible.queries) }}
<script>
showHide(document.getElementById('configuration_section'));
showHide(document.getElementById('resources_configuration_section'));
showHide(document.getElementById('full_configuration_section'));
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion monitoring/uss_qualifier/reports/tested_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def generate_tested_requirements(
participant_breakdown, report.report, participant_id, req_set
)
_populate_breakdown_with_action_declaration(
participant_breakdown, report.configuration.action, req_set
participant_breakdown, report.configuration.v1.test_run.action, req_set
)
if participant_id in participant_req_collections:
_populate_breakdown_with_req_set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type": "string"
},
"configuration": {
"$ref": "../../configurations/configuration/TestConfiguration.json",
"$ref": "../../configurations/configuration/USSQualifierConfiguration.json",
"description": "Configuration used to run uss_qualifier"
},
"environment_signature": {
Expand Down

0 comments on commit 46f89bc

Please sign in to comment.