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
2 changes: 2 additions & 0 deletions NEXT_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ The release notes should contain at least the following sections:
## Optional migration tasks

## Important information

`successful` attributes in test report objects are deprecated and will be removed in the future (#1428).
5 changes: 2 additions & 3 deletions monitoring/uss_qualifier/common_data_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ class Severity(str, Enum):
"""

Low = "Low"
"""The system meets requirements but could be improved.
"""The system does not fail to meet a requirement, but could be improved.

Further test steps can be executed without impact. A test run with only
Low-Severity issues will be considered successful.
Further test steps can be executed without impact.
"""

def __eq__(self, other):
Expand Down
5 changes: 1 addition & 4 deletions monitoring/uss_qualifier/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,7 @@ def execute_test_run(
action = TestSuiteAction(config.action, resources)
logger.info("Running top-level test suite action")
report = action.run(context)
if report.successful():
logger.info("Final result: SUCCESS")
else:
logger.warning("Final result: FAILURE")
logger.info("Top-level test suite action complete")

return TestRunReport(
codebase_version=description.codebase_version,
Expand Down
10 changes: 7 additions & 3 deletions monitoring/uss_qualifier/reports/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from datetime import UTC, datetime
from typing import Any

import deprecation
from implicitdict import (
ImplicitDict,
Optional,
Expand Down Expand Up @@ -132,6 +133,7 @@ class TestStepReport(ImplicitDict):
def has_critical_problem(self) -> bool:
return any(fc.severity == Severity.Critical for fc in self.failed_checks)

@deprecation.deprecated()
def successful(self) -> bool:
return False if self.failed_checks else True

Expand Down Expand Up @@ -304,7 +306,7 @@ class TestScenarioReport(ImplicitDict):
"""Time at which the test scenario completed or encountered an error"""

successful: bool = False
"""True iff test scenario completed normally with no failed checks"""
"""DEPRECATED. True iff test scenario completed normally with no failed checks."""

cases: list[TestCaseReport]
"""Reports for each of the test cases in this test scenario, in chronological order."""
Expand Down Expand Up @@ -414,7 +416,7 @@ class ActionGeneratorReport(ImplicitDict):
"""Time at which the action generator completed or encountered an error"""

successful: bool = False
"""True iff all actions completed normally with no failed checks"""
"""DEPRECATED. True iff all actions completed normally with no failed checks"""

def has_critical_problem(self) -> bool:
return any(a.has_critical_problem() for a in self.actions)
Expand Down Expand Up @@ -507,6 +509,7 @@ def _conditional(
else:
raise self.invalid_type_error

@deprecation.deprecated()
def successful(self) -> bool:
return self._conditional(lambda report: report.successful)

Expand Down Expand Up @@ -726,6 +729,7 @@ class SkippedActionReport(ImplicitDict):
"""Full declaration of the action that was skipped."""

@property
@deprecation.deprecated()
def successful(self) -> bool:
return True

Expand Down Expand Up @@ -770,7 +774,7 @@ class TestSuiteReport(ImplicitDict):
"""Time at which the test suite completed"""

successful: bool = False
"""True iff test suite completed normally with no failed checks"""
"""DEPRECATED. True iff test suite completed normally with no failed checks"""

capability_evaluations: list[ParticipantCapabilityEvaluationReport]
"""List of capabilities defined in this test suite, evaluated for each participant."""
Expand Down
2 changes: 1 addition & 1 deletion monitoring/uss_qualifier/reports/sequence_view/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _step_events(
)
for pid in participants:
p = scenario_participants.get(pid, TestedParticipant())
p.has_successes = True
p.has_passes = True
scenario_participants[pid] = p

# Create events for this step's queries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def rows(self) -> int:
class TestedParticipant:
has_failures: bool = False
has_infos: bool = False
has_successes: bool = False
has_passes: bool = False
has_queries: bool = False


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def make_breakdown(
if participant_reqs is not None:
_populate_breakdown_with_req_set(participant_breakdown, participant_reqs)
if REQ_RUN_TO_COMPLETION in participant_reqs:
# Add a success to REQ_RUN_TO_COMPLETION if nothing caused it to fail
# Add a passing check to REQ_RUN_TO_COMPLETION if nothing caused it to fail
tested_requirement = _tested_requirement_for(
REQ_RUN_TO_COMPLETION, participant_breakdown
)
Expand All @@ -113,7 +113,7 @@ def make_breakdown(
url="",
has_todo=False,
is_finding_acceptable=False,
successes=1,
passes=1,
)
],
)
Expand Down Expand Up @@ -405,7 +405,7 @@ def _add_check_to_breakdown_for_req(
tested_check.url = check.documentation_url
tested_step.checks.append(tested_check)
if isinstance(check, PassedCheck):
tested_check.successes += 1
tested_check.passes += 1
elif isinstance(check, FailedCheck):
if check.severity == Severity.Low:
tested_check.findings += 1
Expand Down
20 changes: 10 additions & 10 deletions monitoring/uss_qualifier/reports/tested_requirements/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ class TestedCheck(ImplicitDict):
url: str
has_todo: bool
is_finding_acceptable: bool
successes: int = 0
passes: int = 0
findings: int = 0
failures: int = 0

@property
def result(self) -> str:
if self.failures > 0:
return "Fail"
if self.findings > 0 and self.successes == 0:
if self.findings > 0 and self.passes == 0:
return "Findings"
if self.findings == 0 and self.successes > 0:
if self.findings == 0 and self.passes > 0:
return "Pass"
if self.findings > 0 and self.successes > 0:
if self.findings > 0 and self.passes > 0:
return "Pass (with findings)"
return "Not tested"

@property
def check_classname(self) -> str:
if self.failures > 0:
return ACCEPTED_FINDINGS_CLASS if self.is_finding_acceptable else FAIL_CLASS
if self.successes + self.failures == 0:
if self.passes + self.failures == 0:
if self.has_todo:
return HAS_TODO_CLASS
else:
Expand All @@ -53,7 +53,7 @@ def check_classname(self) -> str:
@property
def result_classname(self) -> str:
if self.is_finding_acceptable:
if self.successes > 0:
if self.passes > 0:
return PASS_CLASS
elif self.failures > 0 or self.findings > 0:
return ACCEPTED_FINDINGS_CLASS
Expand All @@ -62,7 +62,7 @@ def result_classname(self) -> str:
else:
if self.failures > 0:
return FAIL_CLASS
if self.successes + self.failures + self.findings == 0:
if self.passes + self.failures + self.findings == 0:
return NOT_TESTED_CLASS
if self.findings > 0:
return FINDINGS_CLASS
Expand Down Expand Up @@ -139,15 +139,15 @@ def checks(self) -> Iterable[TestedCheck]:
def status(self) -> TestedRequirementStatus:
if any((c.failures > 0 and not c.is_finding_acceptable) for c in self.checks):
return TestedRequirementStatus.Fail
if all(c.successes == 0 for c in self.checks) and any(
if all(c.passes == 0 for c in self.checks) and any(
c.findings > 0 for c in self.checks
):
return TestedRequirementStatus.Findings
if any(c.successes > 0 for c in self.checks) and any(
if any(c.passes > 0 for c in self.checks) and any(
(c.findings > 0 and not c.is_finding_acceptable) for c in self.checks
):
return TestedRequirementStatus.PassWithFindings
if any(c.successes > 0 for c in self.checks):
if any(c.passes > 0 for c in self.checks):
return TestedRequirementStatus.Pass
return TestedRequirementStatus.NotTested

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


class ParticipantRequirementPerformance(ImplicitDict):
successes: list[JSONPath]
passes: list[JSONPath]
"""List of passed checks involving the requirement"""

failures: list[JSONPath]
Expand Down Expand Up @@ -74,7 +74,7 @@ def _add_check(
)
performance = requirement.participant_performance[participant_id]
if isinstance(check, PassedCheck):
performance.successes.append(path)
performance.passes.append(path)
elif isinstance(check, FailedCheck):
performance.failures.append(path)
else:
Expand Down
16 changes: 8 additions & 8 deletions monitoring/uss_qualifier/suites/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ def _run_test_scenario(self, context: ExecutionContext) -> TestScenarioReport:
except Exception as e:
scenario.record_execution_error(e)
report = scenario.get_report()
if report.successful:
logger.info(f'SUCCESS for "{scenario.documentation.name}" scenario')
if "execution_error" in report and report.execution_error:
lines = report.execution_error.stacktrace.split("\n")
logger.error(
'Execution error in scenario "{}":\n{}',
scenario.documentation.name,
"\n".join(" " + line for line in lines),
)
else:
if "execution_error" in report and report.execution_error:
lines = report.execution_error.stacktrace.split("\n")
logger.error(
"Execution error:\n{}", "\n".join(" " + line for line in lines)
)
logger.warning(f'FAILURE for "{scenario.documentation.name}" scenario')
logger.info(f'"{scenario.documentation.name}" scenario completed')
return report

def _run_test_suite(self, context: ExecutionContext) -> TestSuiteReport:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"type": "string"
},
"successful": {
"description": "True iff all actions completed normally with no failed checks",
"description": "DEPRECATED. True iff all actions completed normally with no failed checks",
"type": "boolean"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"type": "string"
},
"successful": {
"description": "True iff test scenario completed normally with no failed checks",
"description": "DEPRECATED. True iff test scenario completed normally with no failed checks.",
"type": "boolean"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"type": "string"
},
"successful": {
"description": "True iff test suite completed normally with no failed checks",
"description": "DEPRECATED. True iff test suite completed normally with no failed checks",
"type": "boolean"
},
"suite_type": {
Expand Down
Loading