Skip to content

Commit ca24f81

Browse files
authored
[pytest] Add Option to Control Collect Techsupport (#1755)
Adding an option to enable/disable techsupport collection from the command line. Default is enabled. signed-off-by: Tamer Ahmed <tamer.ahmed@microsoft.com>
1 parent b0237f1 commit ca24f81

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/conftest.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ def pytest_addoption(parser):
111111
help="Change default loops delay")
112112
parser.addoption("--logs_since", action="store", type=int,
113113
help="number of minutes for show techsupport command")
114+
parser.addoption("--collect_techsupport", action="store", default=True, type=bool,
115+
help="Enable/Disable tech support collection. Default is enabled (True)")
114116

115117
############################
116118
# sanity_check options #
@@ -358,7 +360,7 @@ def collect_techsupport(request, duthost):
358360
# request.node is an "item" because we use the default
359361
# "function" scope
360362
testname = request.node.name
361-
if request.node.rep_call.failed:
363+
if request.config.getoption("--collect_techsupport") and request.node.rep_call.failed:
362364
res = duthost.shell("generate_dump")
363365
fname = res['stdout']
364366
duthost.fetch(src=fname, dest="logs/{}".format(testname))

0 commit comments

Comments
 (0)