Skip to content
Merged
Show file tree
Hide file tree
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
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