Skip to content

[pytest]: Fail WR ARP test earlier with empty DIP#1986

Merged
theasianpianist merged 2 commits intosonic-net:masterfrom
theasianpianist:test_wr_arp_empty_dip
Jul 29, 2020
Merged

[pytest]: Fail WR ARP test earlier with empty DIP#1986
theasianpianist merged 2 commits intosonic-net:masterfrom
theasianpianist:test_wr_arp_empty_dip

Conversation

@theasianpianist
Copy link
Contributor

@theasianpianist theasianpianist commented Jul 28, 2020

  • Add assertion to arp/test_wr_arp.py to catch an empty DIP returned
    from DUT host

Signed-off-by: Lawrence Lee lawlee@microsoft.com

Description of PR

The WR ARP test case does not fail with a clear/useful error message if it receives an empty DIP from the DUT host.
Summary:
Fixes #1985 (issue)

Type of change

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

Approach

What is the motivation for this PR?

Provide clearer failure messages for the WR ARP test case

How did you do it?

Add an assertion to check the length of the DIP string

How did you verify/test it?

  1. Follow steps in [pytest]: WR ARP test fails with unclear message when DIP is empty #1985 to reproduce the error. The test should still fail, but now with the following error message:
>       pytest_assert(len(result['stdout'].strip()) > 0, 'Empty DIP returned')
E       Failed: Empty DIP returned
duthost    = <tests.common.devices.SonicHost object at 
ptfhost    = <tests.common.devices.PTFHost object at 
result     = {'stderr_lines': [], u'cmd': u"ip route show type unicast |\n            sed -...chdir': None, u'stdin_add_newline': True u'stdin': None}}, 'stdout_lines': []}                                                                
self       = <tests.arp.test_wr_arp.TestWrArp instance at 0x7fc7c5827098>
arp/test_wr_arp.py:102: Failed                                                                                                                                                 

Any platform specific information?

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

Documentation

You should be able to return your DUT to a normal state by restarting the exabgp* processes on the PTF host and running the test_announce_routes.py test case.

* Add assertion to arp/test_wr_arp.py to catch an empty DIP returned
from DUT host

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
@theasianpianist theasianpianist requested review from a team and tahmed-dev July 28, 2020 22:39
@@ -98,6 +99,7 @@ def setupFerret(self, duthost, ptfhost):
'''
)
assert len(result['stderr_lines']) == 0, 'Could not obtain DIP'
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the redundant assert above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure that this is redundant, it looks like it's checking for the command failing outright rather than just not returning anything. Is it possible for stdout to be contain content when stderr_lines also contains content?

Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect the return code will be zero in this case. If it is, the module runner will throw and so the assert is redundant in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok sounds good, will fix.

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
@theasianpianist theasianpianist merged commit 335dd63 into sonic-net:master Jul 29, 2020
@theasianpianist theasianpianist deleted the test_wr_arp_empty_dip branch July 29, 2020 19:46
@mithun2498
Copy link

Hi @theasianpianist
I tried running this case in T0 topology with a physical DUT and I am facing the following issue. Kindly help me resolve this issue.

Error Log:
result = duthost.shell(
cmd=r'''ip route show type unicast |
sed -e '/proto 186|proto zebra|proto bgp/!d' -e '/default/d' -ne '/0//p' |
head -n 1 |
sed -ne 's/0/.*$/1/p'
'''
)

  pytest_assert(len(result['stdout'].strip()) > 0, 'Empty DIP returned')

E Failed: Empty DIP returned

duthost =
ptfhost = <tests.common.devices.ptf.PTFHost object at 0x7fdeff0173d0>
result = {'stderr_lines': [], u'cmd': u"ip route show type unicast |\n sed -...tdin_add_newline': True, u'stdin': None}}, 'stdout_lines': [], 'failed': False}
self = <tests.arp.test_wr_arp.TestWrArp instance at 0x7fdeff0ba1e0>
tbinfo = {'auto_recover': 'True', 'comment': 'Tests Broadcom AS7716 vms', 'conf-name': 'vms-sn2700-t0', 'duts': ['dev-msn2700-01'], ...}

arp/test_wr_arp.py:106: Failed

  • generated xml file: /data/sonic-mgmt/tests/logs/24-04-2023/test_wr_arp/tr.xml -
    ---------------------------- live log sessionfinish ----------------------------
    15:12:39 init.pytest_terminal_summary L0064 INFO | Can not get Allure report URL. Please check logs
    =========================== short test summary info ============================
    ERROR arp/test_wr_arp.py::TestWrArp::testWrArp - Failed: Empty DIP returned
    ERROR arp/test_wr_arp.py::TestWrArp::testWrArpAdvance - Failed: Empty DIP ret...
    ========================== 2 error in 344.01 seconds ===========================

Version Details:
SONiC Software Version: SONiC.202211.269499-59c7d39ef
SONiC OS Version: 11
Distribution: Debian 11.6
Kernel: 5.10.0-18-2-amd64
Build commit: 59c7d39
Build date: Tue May 9 17:58:15 UTC 2023
Built by: AzDevOps@vmss-soni00118K
Platform: x86_64-accton_as7716_32x-r0
HwSKU: Accton-AS7716-32X
ASIC: broadcom
ASIC Count: 1

kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
4236bc4 [config reload] Fixing config reload when timer based delayed services are disabled (sonic-net#1967)
d2514e4 [GCU] Different apply-patch runs should produce same sorted steps (sonic-net#1988)
2878adb [GCU] Using simulated config instead of target config when validating replace operation in NoDependencyMoveValidator (sonic-net#1987)
fb8ca98 [GCU] Loading yang-models only once (sonic-net#1981)
f88ee92 [GCU] Copying config_db before callding sonic_yang.loadData (sonic-net#1983)
9ed0e91 [GCU] Implementing DryRun by printing patch-sorter steps/imitating config_db (sonic-net#1973)
b36b5e3 [GCU] Moving PatchSorter unit-test to json file to make it easier to read/maintain (sonic-net#1977)
c0fa28b [generic-config-updater] Improving CreateOnly validator and marking /LOOPBACK_INTERFACE/LOOPBACK#/vrf_name as create-only (sonic-net#1969)
0559d04 [generic-config-updater] Adding non-strict mode (sonic-net#1929)
b07f477 [debug dump util] FDB debug dump util changes (sonic-net#1968)
6d8757a [warm/fast-reboot] Fix kexec portion to support platforms based on Device Tree (sonic-net#1966)
cc1409e [Auto Techsupport] Event driven Techsupport Bug Fixes (sonic-net#1986)
6c48bd5 Fix wrong help message for cable length setting (sonic-net#1978)
c0bbbe3 [breakout] Fix the check  when port is not present in BREAKOUT_CFG table (sonic-net#1765)
5bb8cad [doc][DPB] Update DPB related interface breakout command Info (sonic-net#1438)
e6fd990 [config] Fix 'config reload -l' command to get filename by default (sonic-net#1611)
bd8f7bb Update swss_ready check to check per namespace swss service (sonic-net#1974)
5439f94 [soft-reboot] Add support for platforms based on Device Tree (sonic-net#1963)
7c5810a [config] Add portchannel support  for static route  (sonic-net#1857)
7cb6a1b preserve old order for config reload (sonic-net#1964)
20bddbd [Auto-Techsupport] Issues related to Multiple Cores crashing handled (sonic-net#1948)
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.

[pytest]: WR ARP test fails with unclear message when DIP is empty

3 participants