Skip to content

Commit

Permalink
Skip GNMI recovery during teardown if reboot was triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanchana-HCLTech committed Jan 31, 2025
1 parent 8399c65 commit 6c553c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/gnmi/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,13 @@ def setup_gnmi_server(duthosts, rand_one_dut_hostname, localhost, ptfhost):

# Rollback configuration
rollback(duthost, SETUP_ENV_CP)
recover_cert_config(duthost)
# Get the skip_gnmi_check flag from duthost options
skip_gnmi_check = duthost.host.options.get('skip_gnmi_check', False)
# Skip GNMI restart if the reboot flag is set
if not skip_gnmi_check:
recover_cert_config(duthost)
else:
logging.info("Skipping GNMI restart due to skip_gnmi_check flag")


@pytest.fixture(scope="module", autouse=True)
Expand Down
3 changes: 3 additions & 0 deletions tests/gnmi/test_gnoi_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def test_gnoi_system_reboot(duthosts, rand_one_dut_hostname, localhost):
"""
duthost = duthosts[rand_one_dut_hostname]

# Set flag to indicate that this test involves reboot
duthost.host.options['skip_gnmi_check'] = True

# Trigger reboot
ret, msg = gnoi_request(duthost, localhost, "Reboot", '{"method": 1}')
pytest_assert(ret == 0, "System.Reboot API reported failure (rc = {}) with message: {}".format(ret, msg))
Expand Down

0 comments on commit 6c553c3

Please sign in to comment.