Add conditional check to skip snmp lldp pytest case when topo is ptf32 or ptf64.#1468
Add conditional check to skip snmp lldp pytest case when topo is ptf32 or ptf64.#1468lguohan merged 3 commits intosonic-net:masterfrom EmmaLin11:master
Conversation
…o is ptf32 or ptf64. When topo is ptf32 or ptf64, snmp lldp pytest will failed. Because there are no lldp data respond from sonic device. The topologies for lldp does not include ptf32 and ptf64 on testcase.yml. Thus the ptf32 and ptf64 topo shall be skipped. Signed-off-by: Emma Lin <[email protected]>
|
@wangxin , I do not know if this is the best way to skip a test for a testbed. I do not like ptf32, ptf64, too many ptf, we should at least skip all ptf testbeds. maybe it is better to define a function to check the testbed type, only ptf, t0, t1. then, we can then filter the test based on testbed type. |
tests/snmp/test_snmp_lldp.py
Outdated
|
|
||
| @pytest.fixture(scope="module", autouse=True) | ||
| def setup_check_topo(testbed): | ||
| if testbed['topo']['name'] in ('ptf32','ptf64'): |
There was a problem hiding this comment.
this is difficult to maintain. we should at least define a function get_testbed_type(), and only three type should be returned t1, t0, and ptf.
There was a problem hiding this comment.
@lguohan , I get it. I defined get_testbed_type() for it. But I have some questions. What is the type of this function? It's a common function? If yes, where should I define this function? Could you give me some advice? Thanks.
There was a problem hiding this comment.
Would you please consider adding a field to the object created in class TestbddInfo which is defined in tests/conftest.py. For example:
class TestbedInfo(object):
...
def __init__(self, testbed_file):
...
line['topo']['type'] = self.get_testbed_type()
def get_testbed_type(self):
...
Then in test scripts, you can access it using testbed['topo']['type'].
There was a problem hiding this comment.
@wangxin , thank you for your advice. I added a field 'type' to the object created in class TestbddInfo which is defined in tests/conftest.py to identify testbed type. Could you please review it?
|
second, i like the mark introduced in the pytest.ini, for example bsl. Then, we can use that mark to filter which test to run instead of using this skip. for example, another requirement is to run all tests that allowed to run in t0 testbed. how do we specify that? |
…s defined in tests/conftest.py to identify testbed type.
tests/conftest.py
Outdated
| def get_testbed_type(self, topo_name): | ||
| testbed_type = ['t0', 't1', 'ptf'] | ||
| for val in testbed_type: | ||
| if topo_name.find(val) != -1: |
There was a problem hiding this comment.
suggest to use regex match somehting like ("^(t0|t1|ptf)[-]")?
There was a problem hiding this comment.
@lguohan , thank you for your advice. I change to use regex match() to check if topo_name matches expected topo_type. Could you please review it?
|
once you change to use regex then, i am good. |
9e740759c370645b4367acf22856aebcfb7fce45 (HEAD -> 201911, origin/201911) [201911][multi asic] show ip bgp summary changes for bgp mon (sonic-net#1483) fa07245786df11e6df902c33fcd9c7115a7c5380 [CLI][techsupport] Merge 'show techsupport' changes from master (sonic-net#1468) Signed-off-by: Abhishek Dosi <[email protected]>
Description of PR
Summary:
Add conditional check to skip snmp lldp pytest case when topo is ptf32 or ptf64.
When topo is ptf32 or ptf64, snmp lldp pytest will failed. Because there are no lldp data respond from sonic device. The topologies for lldp does not include ptf32 and ptf64 on testcase.yml. Thus the ptf32 and ptf64 topo shall be skipped.
Type of change
Approach
How did you do it?
Add conditional check to skip snmp lldp pytest case when topo is ptf32 or ptf64
How did you verify/test it?
Perform pytest to confirm snmp lldp is skipped when topo is ptf32 or ptf64.
Any platform specific information?
N/A
Supported testbed topology if it's a new test case?
N/A
Documentation
N/A