Skip to content

Commit cc5f1ab

Browse files
authored
[action] [PR:18348] argparse conflicting option string (sonic-net#889)
### Description of PR Two option strings, `--num_routes` and `--skip_cleanup` conflict between a couple of test suites. This causes `./run_tests.sh` when executing test cases simultaneously (such as when running the full suite) to exit with an error of something like: ``` argparse.ArgumentError: argument --num_routes: conflicting option string(s): --num_routes ``` Move these arguments into the global scope from their conflicting locations. Fixes sonic-net#5526 ### Type of change - [x] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202012 - [ ] 202205 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 ### Approach #### What is the motivation for this PR? Make running all tests pass #### How did you do it? Move conflicting options to global scope. #### How did you verify/test it? ``` ./run_tests.sh -n vms-kvm-t0 -d vlab-01 -f vtestbed.yaml -i ../ansible/veos_vtb -e "--neighbor_type=sonic" -t t0,any ``` #### Any platform specific information? #### Supported testbed topology if it's a new test case? ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
1 parent bc8b8ad commit cc5f1ab

4 files changed

Lines changed: 9 additions & 23 deletions

File tree

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ def pytest_addoption(parser):
131131
# FWUtil options
132132
parser.addoption('--fw-pkg', action='store', help='Firmware package file')
133133

134+
#####################################
135+
# dash, vxlan, route shared options #
136+
#####################################
137+
parser.addoption("--skip_cleanup", action="store_true", help="Skip config cleanup after test (tests: dash, vxlan)")
138+
parser.addoption("--num_routes", action="store", default=None, type=int,
139+
help="Number of routes (tests: route, vxlan)")
140+
134141
############################
135142
# pfc_asym options #
136143
############################

tests/dash/conftest.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ def pytest_addoption(parser):
3535
help="Apply new configurations on DUT without running tests"
3636
)
3737

38-
parser.addoption(
39-
"--skip_cleanup",
40-
action="store_true",
41-
help="Skip config cleanup after test"
42-
)
43-
4438
parser.addoption(
4539
"--skip_dataplane_checking",
4640
action="store_true",

tests/route/conftest.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ def pytest_addoption(parser):
88

99
route_group = parser.getgroup("Route test suite options")
1010

11-
route_group.addoption("--num_routes", action="store", default=None, type=int,
12-
help="Number of routes for add/delete")
13-
1411
route_group.addoption("--max_scale", action="store_true",
1512
help="Test with maximum possible route scale")
1613

tests/vxlan/conftest.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ def pytest_addoption(parser):
6161
help="number of VNETs for VNET VxLAN test"
6262
)
6363

64-
vxlan_group.addoption(
65-
"--num_routes",
66-
action="store",
67-
default=16000,
68-
type=int,
69-
help="number of routes for VNET VxLAN test"
70-
)
71-
7264
vxlan_group.addoption(
7365
"--num_endpoints",
7466
action="store",
@@ -125,12 +117,6 @@ def pytest_addoption(parser):
125117
help="Test IPV6 in IPv6"
126118
)
127119

128-
vxlan_group.addoption(
129-
"--skip_cleanup",
130-
action="store_true",
131-
help="Do not cleanup after VNET VxLAN test"
132-
)
133-
134120
vxlan_group.addoption(
135121
"--skip_apply_config",
136122
action="store_true",
@@ -261,6 +247,8 @@ def scaled_vnet_params(request):
261247
params = {}
262248
params[NUM_VNET_KEY] = request.config.option.num_vnet
263249
params[NUM_ROUTES_KEY] = request.config.option.num_routes
250+
if params[NUM_ROUTES_KEY] is None:
251+
params[NUM_ROUTES_KEY] = 16000
264252
params[NUM_ENDPOINTS_KEY] = request.config.option.num_endpoints
265253
return params
266254

0 commit comments

Comments
 (0)