Skip to content

Commit

Permalink
[Mellanox] wait until hw-management watchdog files ready (sonic-net#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
mssonicbld authored Dec 28, 2023
1 parent a8ad19d commit fb83d4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ def get_watchdog():
"""
Return WatchdogType1 or WatchdogType2 based on system
"""


utils.wait_until(lambda: os.path.exists('/run/hw-management/watchdog/main/state'), timeout=10, interval=1)
watchdog_main_device_name = None

for device in os.listdir("/dev/"):
Expand Down
2 changes: 2 additions & 0 deletions platform/mellanox/mlnx-platform-api/tests/test_watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@


class TestWatchdog:
@mock.patch('sonic_platform.utils.wait_until', mock.MagicMock())
@mock.patch('sonic_platform.watchdog.is_mlnx_wd_main')
@mock.patch('sonic_platform.watchdog.os.listdir')
def test_get_watchdog_no_device(self, mock_listdir, mock_is_main):
Expand All @@ -50,6 +51,7 @@ def test_get_watchdog_no_device(self, mock_listdir, mock_is_main):
mock_is_main.return_value = False
assert get_watchdog() is None

@mock.patch('sonic_platform.utils.wait_until', mock.MagicMock())
@mock.patch('sonic_platform.watchdog.is_mlnx_wd_main')
@mock.patch('sonic_platform.watchdog.is_wd_type2')
@mock.patch('sonic_platform.watchdog.os.listdir', mock.MagicMock(return_value=['watchdog1', 'watchdog2']))
Expand Down

0 comments on commit fb83d4d

Please sign in to comment.