Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/common/connections/ssh_console_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ def login_stage_2(self,
user_sent = True

# Search for password pattern / send password
if user_sent and not password_sent and re.search(pwd_pattern, output, flags=re.I):
# Use return_msg (accumulated) instead of output to handle cases where
# 'Password:' prompt is split across multiple TCP reads (e.g. 'Pa' + 'ssword:')
if user_sent and not password_sent and re.search(pwd_pattern, return_msg, flags=re.I):
self.write_channel(password + self.RETURN)
time.sleep(0.5 * delay_factor)
output = self.read_channel()
Expand Down
5 changes: 3 additions & 2 deletions tests/dut_console/test_idle_timeout.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import time

import pytest

from tests.common.helpers.assertions import pytest_assert
Expand All @@ -17,12 +18,12 @@
def test_timeout(duthost_console, duthosts, enum_supervisor_dut_hostname):
duthost = duthosts[enum_supervisor_dut_hostname]
logger.info("Get default session idle timeout")
default_tmout = duthost_console.send_command('echo $TMOUT')
default_tmout = duthost_console.send_command('echo $TMOUT').strip().splitlines()[0].strip()
pytest_assert(default_tmout == DEFAULT_TMOUT, "default timeout on dut is not {} seconds".format(DEFAULT_TMOUT))

logger.info("Set session idle timeout")
duthost_console.send_command('export TMOUT={}'.format(SET_TMOUT))
set_tmout = duthost_console.send_command('echo $TMOUT')
set_tmout = duthost_console.send_command('echo $TMOUT').strip().splitlines()[0].strip()
pytest_assert(set_tmout == SET_TMOUT, "set timeout fail")

time.sleep(15)
Expand Down
Loading