Skip to content

Commit

Permalink
[uss_qualifier/reports] Add globally-expanded report artifact (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminPelletier authored Nov 18, 2024
1 parent c4bdcc8 commit ab32155
Show file tree
Hide file tree
Showing 16 changed files with 759 additions and 11 deletions.
1 change: 1 addition & 0 deletions github_pages/static/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ These reports were generated during continuous integration for the most recent P

* [Sequence view](./artifacts/uss_qualifier/reports/f3548_self_contained/sequence)
* [Tested requirements](./artifacts/uss_qualifier/reports/f3548_self_contained/gate3)
* [Globally-expanded report](./artifacts/uss_qualifier/reports/f3548_self_contained/globally_expanded/report.html)

### [US UTM Implementation test configuration](https://github.com/interuss/monitoring/blob/main/monitoring/uss_qualifier/configurations/dev/utm_implementation_us.yaml)

Expand Down
7 changes: 7 additions & 0 deletions monitoring/uss_qualifier/common_data_definitions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from __future__ import annotations

from enum import Enum
from typing import List


class Severity(str, Enum):
Expand Down Expand Up @@ -94,3 +97,7 @@ def symbol(self) -> str:
Severity.High.value: "🛑",
Severity.Critical.value: "☢",
}.get(self.value, "�")

@staticmethod
def all_values() -> List[Severity]:
return [Severity.Low, Severity.Medium, Severity.High, Severity.Critical]
8 changes: 8 additions & 0 deletions monitoring/uss_qualifier/configurations/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ class RawReportConfiguration(ImplicitDict):
"""To pretty-print JSON content, specify an indent level (generally 2), or omit or set to None to write compactly."""


class GloballyExpandedReportConfiguration(ImplicitDict):
redact_access_tokens: bool = True
"""When True, look for instances of "Authorization" keys in the report with values starting "Bearer " and redact the signature from those access tokens"""


class ArtifactsConfiguration(ImplicitDict):
raw_report: Optional[RawReportConfiguration] = None
"""Configuration for raw report generation"""
Expand All @@ -229,6 +234,9 @@ class ArtifactsConfiguration(ImplicitDict):
sequence_view: Optional[SequenceViewConfiguration] = None
"""If specified, configuration describing a desired report describing the sequence of events that occurred during the test"""

globally_expanded_report: Optional[GloballyExpandedReportConfiguration] = None
"""If specified, configuration describing a desired report mimicking what might be seen had the test run been conducted manually."""


class USSQualifierConfigurationV1(ImplicitDict):
test_run: Optional[TestConfiguration] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ v1:
# Write out a human-readable report showing the sequence of events of the test
sequence_view: {}

# Write out a long-form report mimicking if the test run was performed manually
globally_expanded_report: {}

# This block defines whether to return an error code from the execution of uss_qualifier, based on the content of the
# test run report. All of the criteria must be met to return a successful code.
validation:
Expand Down
4 changes: 4 additions & 0 deletions monitoring/uss_qualifier/make_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from implicitdict import ImplicitDict
from loguru import logger

from monitoring.monitorlib import inspection
from monitoring import uss_qualifier as uss_qualifier_module
from monitoring.uss_qualifier.configurations.configuration import (
USSQualifierConfiguration,
USSQualifierConfigurationV1,
Expand Down Expand Up @@ -61,6 +63,8 @@ def main() -> int:
else:
config_names = [config_in_report] * len(report_paths)

inspection.import_submodules(uss_qualifier_module)

for config_name, report_path in zip(config_names, report_paths):
logger.info(
f"========== Generating artifacts for configuration {config_name} and report {report_path} =========="
Expand Down
4 changes: 4 additions & 0 deletions monitoring/uss_qualifier/reports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ The [tested requirements artifact](./tested_requirements) summarizes a test run'
### Sequence view

The [sequence view artifact](./sequence_view) is a human-readable description/log of what happened during a test run. This artifact is a good starting point to understand or debug what happened during a test run.

### Globally-expanded report

The [globally-expanded report artifact](./globally_expanded/README.md) assembles procedural information about the test run into a single, flat presentation, mimicking what might be seen as output had the automated test been performed manually.
16 changes: 16 additions & 0 deletions monitoring/uss_qualifier/reports/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from implicitdict import ImplicitDict
from monitoring.uss_qualifier.configurations.configuration import ArtifactsConfiguration
from monitoring.uss_qualifier.reports.documents import make_report_html
from monitoring.uss_qualifier.reports.globally_expanded.generate import (
generate_globally_expanded_report,
)
from monitoring.uss_qualifier.reports.report import TestRunReport, redact_access_tokens
from monitoring.uss_qualifier.reports.sequence_view.generate import (
generate_sequence_view,
Expand Down Expand Up @@ -87,3 +90,16 @@ def _should_redact(cfg) -> bool:
redacted_report if _should_redact(artifacts.sequence_view) else report
)
generate_sequence_view(report_to_write, artifacts.sequence_view, path)

if artifacts.globally_expanded_report:
# Globally-expanded report
path = os.path.join(output_path, "globally_expanded")
logger.info(f"Writing globally-expanded report to {path}")
report_to_write = (
redacted_report
if _should_redact(artifacts.globally_expanded_report)
else report
)
generate_globally_expanded_report(
report_to_write, artifacts.globally_expanded_report, path
)
3 changes: 3 additions & 0 deletions monitoring/uss_qualifier/reports/globally_expanded/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Globally-expanded report artifact

The globally-expanded report artifact assembles procedural information about the test run into a single, flat presentation. It is intended to mimic what might be seen as output had the automated test been performed manually.
Empty file.
Loading

0 comments on commit ab32155

Please sign in to comment.