-
Notifications
You must be signed in to change notification settings - Fork 34
feat(anta): Add evidence field to TestResult #1117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(anta): Add evidence field to TestResult #1117
Conversation
CodSpeed Performance ReportMerging #1117 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an optional evidence saving mechanism for test results by adding a save_evidence parameter and related logic throughout the code. Key changes include:
- Adding a new execute method in asynceapi/device.py and a get_result helper in asynceapi/_models.py.
- Propagating a save_evidence parameter in anta/runner.py and updating AntaTest initialization in anta/models.py to attach evidence.
- Enhancing TestResult with a new evidence property and adding a serialize_results method in the result manager.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
asynceapi/device.py | Added execute method for EapiRequest execution with enhanced error handling. |
asynceapi/_models.py | Added a helper method get_result for retrieving a command result by index. |
anta/tests/cvx.py | Updated test failure messages to improve clarity of expected state. |
anta/runner.py | Introduced save_evidence parameter propagation in test coroutine creation. |
anta/result_manager/models.py | Added TestEvidence and updated TestResult to support evidence serialization. |
anta/result_manager/init.py | Added serialize_results to include evidence when dumping test results. |
anta/models.py | Introduced AntaCommandMetadata and updated AntaTest to include evidence saving. |
anta/device.py | Adjusted command execution flow and error logging to leverage new error handling. |
Comments suppressed due to low confidence (2)
asynceapi/device.py:469
- Typo in the docstring: 'EapiReponseError' should be 'EapiResponseError'.
raise an EapiReponseError if the response contains errors, by default True.
anta/device.py:540
- [nitpick] Consider formatting the error message by joining multiple errors into a single string for better readability rather than conditionally displaying a single error or a list.
logger.error("Command '%s' failed on %s: %s", command.command, self.name, command.errors[0] if len(command.errors) == 1 else command.errors)
319f4e8
to
4d5d27d
Compare
01f0458
to
d85f5ef
Compare
|
#680 will return the full run context so this is no longer needed. |
Description
Add
save_evidence
parameter to the runner to optionally save each test inputs and commands to their respective TestResult.Fixes #1103
Checklist:
pre-commit run
)tox -e testenv
)