Repository navigation
test(health): measure the health check timeout with time.monotonic() - #1328
Merged
Merged
Conversation
DaprHealth computes its deadline with time.monotonic(), but the tests measured the elapsed time with time.time(). On Windows the two clocks have different resolutions, so the >= 2.5 check failed now and then (2.4987 s) although the code waited the full timeout. Use the same clock in the tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1328 +/- ##
=======================================
Coverage 87.27% 87.27%
=======================================
Files 163 163
Lines 13069 13069
=======================================
Hits 11406 11406
Misses 1663 1663 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CasperGN
approved these changes
Oct 21, 2026
CasperGN
pushed a commit
that referenced
this pull request
Oct 21, 2026
…1328) (#1330) DaprHealth computes its deadline with time.monotonic(), but the tests measured the elapsed time with time.time(). On Windows the two clocks have different resolutions, so the >= 2.5 check failed now and then (2.4987 s) although the code waited the full timeout. Use the same clock in the tests. (cherry picked from commit 02e3f00) Signed-off-by: Nelson Parente <nelson_parente@live.com.pt> Signed-off-by: dapr-bot <dapr-bot@users.noreply.github.com> Co-authored-by: Nelson Parente <nelson_parente@live.com.pt> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
test_wait_for_sidecar_timeoutfails now and then on Windows with Python 3.10, for example on #1327 and #1323:DaprHealth.wait_until_ready()andwait_for_sidecar()compute their deadline withtime.monotonic(). The tests measured the elapsed time withtime.time(). On Windows the two clocks have different resolutions, so the wall-clock reading can be a few milliseconds shorter than the monotonic one. The>= 2.5check then fails although the code waited the full timeout.The tests now use
time.monotonic(), the same clock as the code. The test takes its start time before the code does, and the code raises only whentime.monotonic()passes the code's start plus the timeout. So the check holds on every platform. The upper-bound checks in the same two files also move totime.monotonic().The same tests are on
release-1.19, so this PR needs thebackport release-1.19label.Issue reference
None.
Checklist
pytest tests/clients/test_healthcheck.py tests/clients/test_healthcheck_async.py: 10 passedruff checkandruff format --checkpass🤖 Generated with Claude Code