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

Enhance test_ro_disk to ensure device finally be recovered by PDU reboot #14343

Merged
merged 1 commit into from
Sep 1, 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
14 changes: 10 additions & 4 deletions tests/tacacs/test_ro_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time

from ansible.errors import AnsibleConnectionFailure
from pytest_ansible.errors import AnsibleConnectionFailure as PytestAnsibleConnectionFailure
from tests.common.devices.base import RunAnsibleModuleFail
from tests.common.utilities import wait_until
from tests.common.utilities import skip_release
Expand Down Expand Up @@ -82,7 +83,7 @@ def do_reboot(duthost, localhost, duthosts):
localhost.wait_for(host=duthost.mgmt_ip, port=22, state="stopped", delay=5, timeout=60)
rebooted = True
break
except AnsibleConnectionFailure as e:
except (AnsibleConnectionFailure, PytestAnsibleConnectionFailure) as e:
logger.error("DUT not reachable, exception: {} attempt:{}/{}".
format(repr(e), i, retries))
except RunAnsibleModuleFail as e:
Expand Down Expand Up @@ -264,9 +265,14 @@ def test_ro_disk(localhost, ptfhost, duthosts, enum_rand_one_per_hwsku_hostname,
finally:
logger.debug("START: reboot {} to restore disk RW state".
format(enum_rand_one_per_hwsku_hostname))
if not do_reboot(duthost, localhost, duthosts):
logger.warning("Failed to reboot {}, try PDU reboot to restore disk RW state".
format(enum_rand_one_per_hwsku_hostname))
try:
if not do_reboot(duthost, localhost, duthosts):
logger.warning("Failed to reboot {}, try PDU reboot to restore disk RW state".
format(enum_rand_one_per_hwsku_hostname))
do_pdu_reboot(duthost, localhost, duthosts, pdu_controller)
except Exception as e:
logger.warning("Failed to reboot {}, got exception {}, try PDU reboot to restore disk RW state".
format(enum_rand_one_per_hwsku_hostname, e))
do_pdu_reboot(duthost, localhost, duthosts, pdu_controller)
logger.debug(" END: reboot {} to restore disk RW state".
format(enum_rand_one_per_hwsku_hostname))
Expand Down
Loading