-
Couldn't load subscription status.
- Fork 257
Feat(anta_runner): Add toggle to sort tests by status #6066
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
base: devel
Are you sure you want to change the base?
Feat(anta_runner): Add toggle to sort tests by status #6066
Conversation
|
Review docs on Read the Docs To test this pull request: # Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-6066
# Activate the virtual environment
source test-avd-pr-6066/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/vitthalmagadum/avd.git@anta_runner/sort-toggle#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/vitthalmagadum/avd.git#/ansible_collections/arista/avd/,anta_runner/sort-toggle --force
# Optional: Install AVD examples
cd test-avd-pr-6066
ansible-playbook arista.avd.install_examples |
|
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.
Let's take the opportunity to improve the data model for report:
"report": {
"type": "dict",
"options": {
"csv_output": {"type": "str"},
"md_output": {"type": "str"},
"json_output": {"type": "str"},
"filters": {
"type": "dict",
"options": {
"exclude_statuses": { # Renamed from hide_statuses
"type": "list",
"elements": "str",
"choices": ["success", "failure", "error", "skipped", "unset"]
}
}
},
"sorting": {
"type": "dict",
"options": {
"status_priority": {
"type": "list",
"elements": "str",
"choices": ["success", "failure", "error", "skipped", "unset"],
"default": ["error", "failure", "skipped", "success", "unset"],
},
"sort_by": {
"type": "list",
"elements": "str",
"choices": ["device", "categories", "test", "description", "result", "custom_field"],
"default": ["device", "categories", "test", "description", "result", "custom_field"],
}
}
}
}
}status_priority would act as the primary sort. We would first group all tests by their status, following status_priority order.
@JulioPDX Would you be OK with the following:
For example:
sorting:
status_priority:
- failure
- error
- skipped
sort_by:
- deviceWith this:
- All failures at the top (sorted by
device). - Then, all errors (sorted by
device). - Then, all skipped tests (also sorted by
device). - Any remaining statuses (like "success") would come last.
I know we don't have all functionalities in ANTA ResultManager but we can do it in anta_workflow no problem.
|
@carl-baillargeon The workflow makes sense. It solves the issue of having to search through the reports on failures (helpful on an active change control or troubleshooting event). |



Change Summary
Add toggle to sort tests by status
Related Issue(s)
Fixes #5949
Component(s) name
arista.avd.anta_runnerProposed changes
Add toggle to sort tests by status
How to test
Tested locally
anta_report.json
anta_report.md
Checklist
User Checklist
Repository Checklist