Skip to content

Commit

Permalink
[uss_qualifier/reports] Indicate artifact configuration in tested req…
Browse files Browse the repository at this point in the history
…uirements (interuss#726)

Indicate artifact configuration in tested requirements
  • Loading branch information
BenjaminPelletier authored Jul 3, 2024
1 parent a280dea commit 467f8fd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ <h2>Test run</h2>
</td>
</tr>
</table>
<div class="minor_note">Artifact generated by {{ codebase_version }}</div>
<div class="minor_note">Artifact generated by {{ codebase_version }} with {{ config_source }}</div>
</div>
<div>
<h2>Tested requirements</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,7 @@ class RequirementsVerificationReport(ImplicitDict):

participant_verifications: Dict[ParticipantID, ParticipantVerificationInfo]
"""Information regarding verification of compliance for each participant."""

artifact_configuration: Optional[str]
"""Name of the tested requirements artifact configuration from the test run configuration, or "post-hoc" if the
artifact configuration generating this verification report is not specified in the test run configuration."""
29 changes: 28 additions & 1 deletion monitoring/uss_qualifier/reports/tested_requirements/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@
def generate_tested_requirements(
report: TestRunReport, config: TestedRequirementsConfiguration, output_path: str
) -> None:
# Determine where the configuration to generate these tested requirements originated
artifacts = report.configuration.v1.artifacts
if "tested_requirements" in artifacts and artifacts.tested_requirements:
i = (
artifacts.tested_requirements.index(config)
if config in artifacts.tested_requirements
else -1
)
n = len(artifacts.tested_requirements)
if i < 0:
config_source = "custom post-hoc artifact configuration"
artifact_configuration = "post-hoc"
elif n == 1:
config_source = "test run artifact configuration"
artifact_configuration = config.report_name
else:
config_source = (
f"test run artifact configuration {i + 1}/{n}: {config.report_name}"
)
artifact_configuration = config.report_name
else:
config_source = "post-hoc artifact configuration"
artifact_configuration = "post-hoc"

req_collections: Dict[
TestedRequirementsCollectionIdentifier, Set[RequirementID]
] = {}
Expand Down Expand Up @@ -72,7 +96,9 @@ def generate_tested_requirements(
f.write(template.render(participant_ids=reported_participant_ids))

verification_report = RequirementsVerificationReport(
test_run_information=test_run, participant_verifications={}
test_run_information=test_run,
participant_verifications={},
artifact_configuration=artifact_configuration,
)
template = jinja_env.get_template(
"tested_requirements/participant_tested_requirements.html"
Expand Down Expand Up @@ -112,6 +138,7 @@ def generate_tested_requirements(
system_version=system_version,
ParticipantVerificationStatus=ParticipantVerificationStatus,
codebase_version=get_code_version(),
config_source=config_source,
)
)

Expand Down

0 comments on commit 467f8fd

Please sign in to comment.