Skip to content

Commit

Permalink
add ptfhost check statement to prevent failure on test_posttest.py (#…
Browse files Browse the repository at this point in the history
…14783)

PTFHost can be None in some cases (eg. ixia) and this was not handled correctly in test_collect_ptf_logs. Add ptfhost check to prevent error caused by None value.

PTFHost can be None in some cases (eg. ixia) and this was not handled correctly in test_collect_ptf_logs. Add ptfhost check to prevent error caused by None value.

Description of PR
Summary:
PTFHost can be None in some cases (eg. ixia) and this was not handled correctly in test_collect_ptf_logs. Add ptfhost check to prevent error caused by None value.

Approach
What is the motivation for this PR?
Resolve unexpected error during log collection

How did you do it?
check for None value

co-authorized by: jianquanye@microsoft.com
  • Loading branch information
augusdn authored Sep 30, 2024
1 parent 327b253 commit 2aa1d5f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_posttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def test_enable_startup_tsa_tsb_service(duthosts, localhost):


def test_collect_ptf_logs(ptfhost):
if ptfhost is None:
return
log_files = ptfhost.shell('ls /tmp/*.log')['stdout'].split()
if not os.path.exists('logs/ptf'):
os.makedirs('logs/ptf')
Expand Down

0 comments on commit 2aa1d5f

Please sign in to comment.