Skip to content

[run_test.sh] add maxfail option and improve help information#2013

Merged
yxieca merged 4 commits intosonic-net:masterfrom
yxieca:run_test
Aug 3, 2020
Merged

[run_test.sh] add maxfail option and improve help information#2013
yxieca merged 4 commits intosonic-net:masterfrom
yxieca:run_test

Conversation

@yxieca
Copy link
Collaborator

@yxieca yxieca commented Aug 2, 2020

Summary:
Fixes # (issue)

Type of change

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

Approach

What is the motivation for this PR?

PR test behavior changed after switching over to use run_tests.sh. It is no longer stop at first failure and causing longer run time for failed tests.

How did you do it?

  • Allow setting maxfail for the test.
  • Allow disabling auto recovery
  • With individual method, if maxfail is set, any failure in a test
    module will cause test to end.
  • Explicit about options with parameter.

Signed-off-by: Ying Xie [email protected]

How did you verify/test it?

Don't specify -q 1 option:

yinxi@acs-trusty8:/var/src/sonic-mgmt/tests$ ./run_tests.sh -d str-dx010-acs-1 -n vms3-t1-dx010-1 -i /var/src/sonic-mgmt/ansible/str,/var/src/sonic-mgmt/ansible/veos -u -m group -p /tmp/logs-01 -c copp/test_copp.py
=== Running tests in groups ===

copp/test_copp.py::TestCOPP::test_policer[ARP]
------------------------------------------------------------------------------------- live log setup -------------------------------------------------------------------------------------
19:53:09 WARNING recover.py:recover:92: Try to recover str-dx010-acs-1 using method adaptive
19:53:09 WARNING recover.py:adaptive_recover:80: Restoring {'check_item': 'processes', 'failed': True, 'services_status': {'lldp': True, 'bgp': True, 'pmon': True, 'database': True, 'teamd': True, 'swss': False, 'syncd': True, 'snmp': True}, 'processes_status': {'lldp': {'status': True, 'exited_critical_process': [], 'running_critical_process': [u'lldp-syncd', u'lldpd', u'lldpmgrd']}, 'pmon': {'status': True, 'exited_critical_process': [], 'running_critical_process': [u'psud', u'xcvrd']}, 'database': {'status': True, 'exited_critical_process': [], 'running_critical_process': [u'redis']}, 'snmp': {'status': True, 'exited_critical_process': [], 'running_critical_process': [u'snmp-subagent', u'snmpd']}, 'bgp': {'status': True, 'exited_critical_process': [], 'running_critical_process': [u'bgpcfgd', u'bgpd', u'fpmsyncd', u'staticd', u'zebra']}, 'teamd': {'status': True, 'exited_critical_process': [], 'running_critical_process': [u'teammgrd', u'teamsyncd']}, 'syncd': {'status': True, 'exited_critical_process': [], 'running_critical_process': [u'syncd']}, 'swss': {'status': False, 'exited_critical_process': [u'orchagent'], 'running_critical_process': [u'buffermgrd', u'intfmgrd', u'nbrmgrd', u'neighsyncd', u'portmgrd', u'portsyncd', u'vlanmgrd', u'vrfmgrd', u'vxlanmgrd']}}} with proposed action: config_reload, final action: config_reload
Loading callback plugin json of type stdout, v2.0 from /usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/json.pyc
Loading callback plugin json of type stdout, v2.0 from /usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/json.pyc
FAILED [ 11%]
copp/test_copp.py::TestCOPP::test_policer[IP2ME] PASSED [ 22%]
copp/test_copp.py::TestCOPP::test_policer[SNMP] PASSED [ 33%]
copp/test_copp.py::TestCOPP::test_policer[SSH] PASSED [ 44%]
copp/test_copp.py::TestCOPP::test_no_policer[BGP] PASSED [ 55%]
copp/test_copp.py::TestCOPP::test_no_policer[DHCP] PASSED [ 66%]
copp/test_copp.py::TestCOPP::test_no_policer[LACP] PASSED [ 77%]
copp/test_copp.py::TestCOPP::test_no_policer[LLDP] PASSED [ 88%]
copp/test_copp.py::TestCOPP::test_no_policer[UDLD] PASSED [100%]

======================================================================================== FAILURES ========================================================================================
=================================================================== 1 failed, 8 passed, 3 warnings in 1154.50 seconds ====================================================================

Specify -q 1 option:
yinxi@acs-trusty8:/var/src/sonic-mgmt/tests$ ./run_tests.sh -d str-dx010-acs-1 -n vms3-t1-dx010-1 -i /var/src/sonic-mgmt/ansible/str,/var/src/sonic-mgmt/ansible/veos -u -m group -p /tmp/logs-01 -c copp/test_copp.py -e -x
=== Running tests in groups ===
================================================================================== test session starts ===================================================================================
platform linux2 -- Python 2.7.12, pytest-4.6.5, py-1.8.1, pluggy-0.13.1
ansible: 2.8.7
rootdir: /var/src/sonic-mgmt/tests, inifile: pytest.ini
plugins: ansible-2.2.2, xdist-1.28.0, forked-1.1.3, repeat-0.8.0
collected 9 items

copp/test_copp.py::TestCOPP::test_policer[ARP] Loading callback plugin json of type stdout, v2.0 from /usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/json.pyc
Loading callback plugin json of type stdout, v2.0 from /usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/json.pyc
FAILED [ 11%]
======================================================================================== FAILURES ========================================================================================
========================================================================= 1 failed, 3 warnings in 453.74 seconds =========================================================================

- Allow setting maxfail for the test.
- With individual method, if maxfail is set, any failure in a test
  module will cause test to end.
- Explicit about options with parameter.

Signed-off-by: Ying Xie <[email protected]>
@yxieca yxieca requested review from a team and lguohan August 2, 2020 20:28
echo " -n : specify testbed name (*)"
echo " -c <testcases> : specify test cases to execute (default: none, executed all matched)"
echo " -d <dut name> : specify DUT name (*)"
echo " -e <paramters> : specify extra parameter(s) (default: none)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo " -e <paramters> : specify extra parameter(s) (default: none)"
echo " -e <parameters> : specify extra parameter(s) (default: none)"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

Comment on lines +13 to +14
echo " -k <log level> : specify file log level: error|warning|info|debug (default debug)"
echo " -l <log level> : specify cli log level: error|warning|info|debug (default warning)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention log vs. cli log level in the tag so it's more clear which is which at a glance?

Copy link
Collaborator Author

@yxieca yxieca Aug 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed. didn't use full wording so that I don't have to move ':' indentation.

fi

PYTEST_UTIL_OPTS=${PYTEST_COMMON_OPTS}
# Max failure only applicable to the test session. Not the preparation and cleanup session.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguohan I can't remember off the top of my head - would a failure in announce_routes or neighbor_health trigger a failure in the old/current PR tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor detail we can come back to later. I'll merge this PR so that you can work on your next change.

@yxieca
Copy link
Collaborator Author

yxieca commented Aug 2, 2020

retest vsimage please

1 similar comment
@yxieca
Copy link
Collaborator Author

yxieca commented Aug 2, 2020

retest vsimage please

@yxieca yxieca merged commit 9d90cd4 into sonic-net:master Aug 3, 2020
@yxieca yxieca deleted the run_test branch August 3, 2020 05:48
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
includes:

320591a [DualToR] Handle race condition between tunnel_decap and mux orchestrator (sonic-net#2114)
5027a8f Handling Invalid CRM configuration gracefully (sonic-net#2109)
0b120fa [ci]: use native arm64 and armhf pool (sonic-net#2013)
394e88a Don't handle buffer pool watermark during warm reboot reconciling (sonic-net#1987)
9008a01 patch for issue sonic-net#1971 - enable Rx Drop handling for cisco-8000 (sonic-net#2041)
2723ee3 create debug_shell_enable config to enable debug shell (sonic-net#2060)
d7be0b9 [request parser] Add unit tests for request parser for multiple values (sonic-net#1766)
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.

3 participants