From 46f89bc04c6537b1e0c9b6eec611144eaa9457f3 Mon Sep 17 00:00:00 2001 From: Benjamin Pelletier Date: Fri, 29 Dec 2023 00:32:19 +0000 Subject: [PATCH] [uss_qualifier] Include whole config in report (#453) * Include whole config in report * Improve configuration display in sequence_view --- monitoring/uss_qualifier/main.py | 2 +- monitoring/uss_qualifier/reports/report.py | 4 +- .../uss_qualifier/reports/sequence_view.py | 32 ++++++++++++++ .../templates/sequence_view/overview.html | 43 ++++++------------- .../reports/tested_requirements.py | 2 +- .../reports/report/TestRunReport.json | 2 +- 6 files changed, 51 insertions(+), 34 deletions(-) diff --git a/monitoring/uss_qualifier/main.py b/monitoring/uss_qualifier/main.py index 20458b4406..50b0ddbcb4 100644 --- a/monitoring/uss_qualifier/main.py +++ b/monitoring/uss_qualifier/main.py @@ -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, ) diff --git a/monitoring/uss_qualifier/reports/report.py b/monitoring/uss_qualifier/reports/report.py index 324d58438c..4f969508f6 100644 --- a/monitoring/uss_qualifier/reports/report.py +++ b/monitoring/uss_qualifier/reports/report.py @@ -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 ( @@ -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 diff --git a/monitoring/uss_qualifier/reports/sequence_view.py b/monitoring/uss_qualifier/reports/sequence_view.py index 16f75fcd60..eb17220920 100644 --- a/monitoring/uss_qualifier/reports/sequence_view.py +++ b/monitoring/uss_qualifier/reports/sequence_view.py @@ -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"{local_name}": f"From {source_name} resource" + for local_name, source_name in resource_dec.dependencies.items() + } + key = f"{resource_id} ({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) @@ -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, diff --git a/monitoring/uss_qualifier/reports/templates/sequence_view/overview.html b/monitoring/uss_qualifier/reports/templates/sequence_view/overview.html index d20a5e531f..36dabe89b2 100644 --- a/monitoring/uss_qualifier/reports/templates/sequence_view/overview.html +++ b/monitoring/uss_qualifier/reports/templates/sequence_view/overview.html @@ -55,35 +55,19 @@

Sequence view of uss_qualifier test run

-
-

Resources configuration

+
+

Resources configuration

- {% for is_baseline in (True, False) %} -

{{ "Baseline" if is_baseline else "Environment" }}

-
    - {% 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) %} -
  • {{ resource_id }} ({{ resource_dec.resource_type }}) -
      - {% if resource_dec.dependencies %} - {% for local_name, source_name in resource_dec.dependencies.items() %} -
    • {{ local_name }}: From {{ source_name }} resource
    • - {% endfor %} - {% endif %} -
    • Specification: - {% set spec_id = "specification_" + resource_id %} - {{ explorer_content(spec_id, resource_dec.specification) }} - {% set collapsible.queries = collapsible.queries + [spec_id] %} -
    • -
    -
  • - {% endif %} - {% set current.address = ".".join(current.address.split(".")[0:-1]) %} - {% endfor %} -
- {% endfor %} + {{ explorer_content("resources_configuration_tree", resources_config) }} + {% set collapsible.queries = collapsible.queries + ["resources_configuration_tree"] %} +
+
+ +
+

Full configuration

+
+ {{ explorer_content("full_configuration_tree", report.configuration) }} + {% set collapsible.queries = collapsible.queries + ["full_configuration_tree"] %}
@@ -160,7 +144,8 @@

Scenarios executed

{{ explorer_footer(collapsible.queries) }} diff --git a/monitoring/uss_qualifier/reports/tested_requirements.py b/monitoring/uss_qualifier/reports/tested_requirements.py index acb0abdbb4..92e9b5e714 100644 --- a/monitoring/uss_qualifier/reports/tested_requirements.py +++ b/monitoring/uss_qualifier/reports/tested_requirements.py @@ -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( diff --git a/schemas/monitoring/uss_qualifier/reports/report/TestRunReport.json b/schemas/monitoring/uss_qualifier/reports/report/TestRunReport.json index 24d10695bd..2f078d65a8 100644 --- a/schemas/monitoring/uss_qualifier/reports/report/TestRunReport.json +++ b/schemas/monitoring/uss_qualifier/reports/report/TestRunReport.json @@ -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": {