-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gcu][dhcp_relay] Fix dhcp_relay container is not running in gcu test (…
…#16460) What is the motivation for this PR? In gcu dhcp_relay test, it would add 2 vlans with 4 dhcp servers. Previously all 8 dhcp servers are added by cli separately, it would restart dhcp_relay container 8 times, which would cause dhcp_relay container is not running in gcu test in some low performance devices. How did you do it? Use sonic-db-cli to add dhcp servers, then manually resetart dhcp_relay container once. How did you verify/test it? Run tests
- Loading branch information
1 parent
d6efd90
commit dd6cb4f
Showing
2 changed files
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from tests.common.helpers.assertions import pytest_assert | ||
from tests.common.utilities import wait_until | ||
|
||
|
||
def restart_dhcp_service(duthost): | ||
duthost.shell('systemctl reset-failed dhcp_relay') | ||
duthost.shell('systemctl restart dhcp_relay') | ||
duthost.shell('systemctl reset-failed dhcp_relay') | ||
|
||
def _is_dhcp_relay_ready(): | ||
output = duthost.shell('docker exec dhcp_relay supervisorctl status | grep dhcp | awk \'{print $2}\'', | ||
module_ignore_errors=True) | ||
return (not output['rc'] and output['stderr'] == '' and len(output['stdout_lines']) != 0 and | ||
all(element == 'RUNNING' for element in output['stdout_lines'])) | ||
|
||
pytest_assert(wait_until(120, 1, 10, _is_dhcp_relay_ready), "dhcp_relay is not ready after restarting") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters