Skip to content

[masic] Fix argument issue in verify_cacl, test_cacl_application#6169

Closed
wenyiz2021 wants to merge 4 commits intosonic-net:masterfrom
wenyiz2021:test_cacl_appl
Closed

[masic] Fix argument issue in verify_cacl, test_cacl_application#6169
wenyiz2021 wants to merge 4 commits intosonic-net:masterfrom
wenyiz2021:test_cacl_appl

Conversation

@wenyiz2021
Copy link
Contributor

@wenyiz2021 wenyiz2021 commented Aug 15, 2022

Signed-off-by: Wenyi Zhang[email protected]

Description of PR

PR Enhance test_cacl_application to support dualtor by ZhaohuiS · Pull Request #5895 · sonic-net/sonic-mgmt (github.com) introduced 2 fixture which should be intended to work for dualtor, while it added argument in verify_cacl, which is also used for test_multiasic_cacl_application, failing to add this argument in this test leads to an argument misleading at runtime, between expected_dhcp_rules_for_standby and enum_frontend_asic_index

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 201911
  • 202012

Approach

What is the motivation for this PR?

Fix issue seen on multi-asic seen after above PR merged

How did you do it?

Add argument expected_dhcp_rules_for_standby in test_cacl_application_dualtor, as the fixture take fixture duthost_dualtor that for non-dualtor, there is only 1 active_tor and returns empty list.

How did you verify/test it?

Before:
30/07/2022 07:12:07 init._log_sep_line L0160 INFO | ==================== cacl/test_cacl_application.py::test_multiasic_cacl_application[3] call ====================
30/07/2022 07:12:07 init.pytest_runtest_call L0040 ERROR | Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/_pytest/python.py", line 1464, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/usr/local/lib/python2.7/dist-packages/pluggy/hooks.py", line 286, in call
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 87, in
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 81, in get_result
_reraise(*ex) # noqa
File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/usr/local/lib/python2.7/dist-packages/_pytest/python.py", line 174, in pytest_pyfunc_call
testfunction(**testargs)
File "/azp/agent/_work/2/s/sonic-mgmt-int/tests/cacl/test_cacl_application.py", line 838, in test_multiasic_cacl_application
verify_cacl(duthost, localhost, creds, docker_network, enum_frontend_asic_index)
File "/azp/agent/_work/2/s/sonic-mgmt-int/tests/cacl/test_cacl_application.py", line 745, in verify_cacl
expected_iptables_rules, expected_ip6tables_rules = generate_expected_rules(duthost, docker_network, asic_index, expected_dhcp_rules_for_standby)
File "/azp/agent/_work/2/s/sonic-mgmt-int/tests/cacl/test_cacl_application.py", line 416, in generate_expected_rules
iptables_rules.extend(expected_dhcp_rules_for_standby)
TypeError: 'int' object is not iterable

After:
cacl/test_cacl_application.py::test_cacl_application_nondualtor PASSED [ 7%]
cacl/test_cacl_application.py::test_cacl_application_dualtor[active_tor] SKIPPED [ 15%]
cacl/test_cacl_application.py::test_cacl_application_dualtor[standby_tor] SKIPPED [ 23%]
cacl/test_cacl_application.py::test_multiasic_cacl_application[active_tor-0] PASSED [ 30%]
cacl/test_cacl_application.py::test_multiasic_cacl_application[standby_tor-0] PASSED [ 38%]
cacl/test_cacl_application.py::test_multiasic_cacl_application[active_tor-1] PASSED [ 46%]
cacl/test_cacl_application.py::test_multiasic_cacl_application[standby_tor-1] PASSED [ 53%]
cacl/test_cacl_application.py::test_multiasic_cacl_application[active_tor-2] PASSED [ 61%]
cacl/test_cacl_application.py::test_multiasic_cacl_application[standby_tor-2] PASSED [ 69%]
cacl/test_cacl_application.py::test_multiasic_cacl_application[active_tor-3] PASSED [ 76%]
cacl/test_cacl_application.py::test_multiasic_cacl_application[standby_tor-3] PASSED [ 84%]
cacl/test_cacl_application.py::test_cacl_scale_rules_ipv4 PASSED [ 92%]
cacl/test_cacl_application.py::test_cacl_scale_rules_ipv6 PASSED [100%]

--------------------------------------------------------------------------------------------- generated xml file: /var/src/sonic-mgmt-int/tests/logs/tr.xml ----------------------------------------------------------------------------------------------
================================================================================================================ short test summary info =================================================================================================================
SKIPPED [2] cacl/test_cacl_application.py: test_cacl_application_dualtor is only supported on dualtor topology
========================================================================================================= 11 passed, 2 skipped in 895.93 seconds =========================================================================================================

Any platform specific information?

Fix for multi-asic dut

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

Documentation

Signed-off-by: Ubuntu <wenyi@wenyi-vm-01.pdewprncsagu3n1l4b35v5n55g.cx.internal.cloudapp.net>
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 15, 2022

CLA Missing ID CLA Not Signed

@wenyiz2021
Copy link
Contributor Author

/easycla

@wenyiz2021 wenyiz2021 changed the title [masic] Fix argument issue in verify_cacl [masic] Fix argument issue in verify_cacl, test_cacl_application Aug 15, 2022
@wenyiz2021
Copy link
Contributor Author

/easycla

@lgtm-com
Copy link

lgtm-com bot commented Aug 15, 2022

This pull request introduces 1 alert when merging d396f1d into d8db030 - view on LGTM.com

new alerts:

  • 1 for Wrong number of arguments in a call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants