Skip to content

Commit

Permalink
[pytest] Add Option to Control Collect Techsupport (#1755)
Browse files Browse the repository at this point in the history
Adding an option to enable/disable techsupport collection from the command
line. Default is enabled.

signed-off-by: Tamer Ahmed <tamer.ahmed@microsoft.com>
  • Loading branch information
tahmed-dev committed Jun 18, 2020
1 parent b0237f1 commit ca24f81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def pytest_addoption(parser):
help="Change default loops delay")
parser.addoption("--logs_since", action="store", type=int,
help="number of minutes for show techsupport command")
parser.addoption("--collect_techsupport", action="store", default=True, type=bool,
help="Enable/Disable tech support collection. Default is enabled (True)")

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

0 comments on commit ca24f81

Please sign in to comment.