Skip to content

Commit 4bd13ee

Browse files
Log the actual watchdog timeout in test error message (sonic-net#20520)
What is the motivation for this PR? To improve test errror message and help with debugging test failure. How did you do it? Log the actual watchdog timeout returned by arm() in test error message , instead of the watchdog_timeout passed to arm() How did you verify/test it? Tested by running the test cases and checking the error message when the tests failed Signed-off-by: Domingo <domingo@nexthop.ai>
1 parent feaa251 commit 4bd13ee

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tests/platform_tests/api/test_watchdog.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,13 @@ def test_arm_too_big_timeout(self, duthosts, enum_rand_one_per_hwsku_hostname,
265265
if watchdog_timeout is None:
266266
pytest.skip('"too_big_timeout" parameter is required for this test case')
267267
actual_timeout = watchdog.arm(platform_api_conn, watchdog_timeout)
268-
self.expect(actual_timeout == -1, "{}: Watchdog should be disarmed, but returned timeout of {} seconds"
269-
.format(self.test_arm_too_big_timeout.__name__, watchdog_timeout))
268+
self.expect(
269+
actual_timeout == -1,
270+
"{}: Watchdog should be disarmed when configured with {} seconds, "
271+
"but returned timeout of {} seconds".format(
272+
self.test_arm_too_big_timeout.__name__, watchdog_timeout, actual_timeout
273+
),
274+
)
270275
self.assert_expectations()
271276

272277
@pytest.mark.dependency(depends=["test_arm_disarm_states"])
@@ -275,6 +280,11 @@ def test_arm_negative_timeout(self, duthosts, enum_rand_one_per_hwsku_hostname,
275280

276281
watchdog_timeout = -1
277282
actual_timeout = watchdog.arm(platform_api_conn, watchdog_timeout)
278-
self.expect(actual_timeout == -1, "{}: Watchdog should be disarmed, but returned timeout of {} seconds"
279-
.format(self.test_arm_negative_timeout.__name__, watchdog_timeout))
283+
self.expect(
284+
actual_timeout == -1,
285+
"{}: Watchdog should be disarmed when configured with {} seconds, "
286+
"but returned timeout of {} seconds".format(
287+
self.test_arm_too_big_timeout.__name__, watchdog_timeout, actual_timeout
288+
),
289+
)
280290
self.assert_expectations()

0 commit comments

Comments
 (0)