Skip to content
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

[action] [PR:15208] Ansible error formatting #15362

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

mssonicbld
Copy link
Collaborator

Description of PR

Summary:
Revises ansible error output to be custom formatted such that it prints in the following order:

  1. Random fields that don't involve readable text printing, such as the command used or how long the test ran.
  2. stdout_lines formatted with proper newlines.
  3. stderr_lines also formatted.

The output is sorted with the most interesting failure information at the bottom, namely the stderr.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

How did you do it?

How did you verify/test it?

Inserted an artificial error on a Cisco-8000 series device, observed below output (trimmed out the tail of the cmd and invocation fields):

E tests.common.errors.RunAnsibleModuleFail: run module shell failed, Ansible Results =>
E failed = True
E changed = True
E end = 2024-10-28 15:03:26.079813
E cmd = /root/env-python3/bin/ptf --test-dir saitests/py3 sai_qos_tests.PFCtest ...
E delta = 0:00:38.058404
E rc = 1
E invocation = {'module_args': {'creates': None, ...
E start = 2024-10-28 15:02:48.021409
E msg = non-zero return code
E _ansible_no_log = None
E
E
E stdout =
E Using packet manipulation module: ptf.packet_scapy
E
E ******************************************
E ATTENTION: SOME TESTS DID NOT PASS!!!
E
E The following tests failed:
E PFCtest
E
E ******************************************
E
E stderr =
E sai_qos_tests.PFCtest ... test dst_port_id: 4, src_port_id: 1, src_vlan: None
E actual dst_port_id: 4
E after send packets short of triggering PFC:
E recv_counters [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 274295, 2756, 0, 0, 298189, 0, 0, 0]
E recv_counters_base [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239377, 2357, 0, 0, 149657, 0, 0, 0]
E xmit_counters [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10403712, 151749, 0, 0, 1384, 0, 0, 0]
E xmit_counters_base [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10338490, 150820, 0, 0, 1268, 0, 0, 0]
E
E FAIL
E
E ======================================================================
E FAIL: sai_qos_tests.PFCtest
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "saitests/py3/sai_qos_tests.py", line 1812, in runTest
E 'ERROR TESTING - unexpectedly PFC counter increase, {}'.format(test_stage))
E File "saitests/py3/sai_qos_tests.py", line 293, in qos_test_assert
E assert condition, message
E AssertionError: ERROR TESTING - unexpectedly PFC counter increase, after send packets short of triggering PFC
E
E ----------------------------------------------------------------------
E Ran 1 test in 37.176s
E
E FAILED (failures=1)

Any platform specific information?

Will affect all platforms.

Supported testbed topology if it's a new test case?

Will affect all topologies.

Documentation

* Revise ansible error formatting.

* Revise to assume stdout_lines and stderr_lines are present.
pre-commit.

* Revert "Revise to assume stdout_lines and stderr_lines are present."

This reverts commit 5f002ae.

* Revise to assume stdout_lines and stderr_lines are present.

* Remove excess newlines.
@mssonicbld mssonicbld mentioned this pull request Nov 5, 2024
8 tasks
@mssonicbld
Copy link
Collaborator Author

Original PR: #15208

@mssonicbld mssonicbld merged commit c982adc into sonic-net:202405 Nov 5, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants