Result Manager models
Test Result model¶
UML Diagram¶
TestResult ¶
Bases: BaseModel
Describe the result of a test from a single device.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Device name where the test has run. |
test |
str
|
Test name runs on the device. |
categories |
List[str]
|
List of categories the TestResult belongs to, by default the AntaTest categories. |
description |
str
|
TestResult description, by default the AntaTest description. |
results |
str
|
Result of the test. Can be one of [“unset”, “success”, “failure”, “error”, “skipped”]. |
message |
str
|
Message to report after the test if any. |
error |
Optional[Exception]
|
Exception object if the test result is “error” and an Exception occured |
custom_field |
Optional[str]
|
Custom field to store a string for flexibility in integrating with ANTA |
is_error ¶
is_error(message: str | None = None, exception: Exception | None = None) -> None
Helper to set status to error
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exception |
Exception | None
|
Optional Exception objet related to the error |
None
|
Source code in anta/result_manager/models.py
71 72 73 74 75 76 77 78 79 |
|
is_failure ¶
is_failure(message: str | None = None) -> None
Helper to set status to failure
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str | None
|
Optional message related to the test |
None
|
Source code in anta/result_manager/models.py
53 54 55 56 57 58 59 60 |
|
is_skipped ¶
is_skipped(message: str | None = None) -> None
Helper to set status to skipped
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str | None
|
Optional message related to the test |
None
|
Source code in anta/result_manager/models.py
62 63 64 65 66 67 68 69 |
|
is_success ¶
is_success(message: str | None = None) -> None
Helper to set status to success
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str | None
|
Optional message related to the test |
None
|
Source code in anta/result_manager/models.py
44 45 46 47 48 49 50 51 |
|
ListResult ¶
Bases: RootModel[List[TestResult]]
list result for all tests on all devices.
Attributes:
Name | Type | Description |
---|---|---|
__root__ |
list[TestResult]
|
A list of TestResult objects. |
append ¶
append(value: TestResult) -> None
Add support for append method.
Source code in anta/result_manager/models.py
114 115 116 |
|
extend ¶
extend(values: list[TestResult]) -> None
Add support for extend method.
Source code in anta/result_manager/models.py
110 111 112 |
|