Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add detailed and meaningful reason for assert failure in test_ssh_limit #12997

Merged
merged 1 commit into from
May 28, 2024
Merged
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
6 changes: 4 additions & 2 deletions tests/ssh/test_ssh_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,16 @@ def test_ssh_limits(duthosts, rand_one_dut_hostname, tacacs_creds, setup_limit):
login_message_1 = get_login_result(ssh_session_1)

logging.debug("Login session 1 result:\n{0}\n".format(login_message_1))
pytest_assert("There were too many logins for" not in login_message_1)
pytest_assert("There were too many logins for" not in login_message_1,
"The first login was rejected due to too many logins")

# The second session will be disconnect by device
ssh_session_2 = paramiko_ssh(dut_ip, local_user, local_user_password)
login_message_2 = get_login_result(ssh_session_2)

logging.debug("Login session 2 result:\n{0}\n".format(login_message_2))
pytest_assert("There were too many logins for" in login_message_2)
pytest_assert("There were too many logins for" in login_message_2,
"The second login was not rejected by ssh limit")

ssh_session_1.close()
ssh_session_2.close()
Loading