test: use monotonic clock for durations in test framework and http_interface #36731

Manually merged
ViniciusCestarii merged 2 commits from test-framework-monotonic into master 2026-11-06 10:13:04 +00:00 AGit
ViniciusCestarii commented 2026-11-02 13:06:23 +00:00 (Migrated from github.com)

Replace time.time() used to measure durations by time.monotonic() in test framework and http_interface.

This helps preventing future clock jump flakiness (same class of bug as #36529) on tests and fix:

faketime --exclude-monotonic -f "+0 x0.5" build/test/functional/feature_torcontrol.py
faketime --exclude-monotonic -f "+0 x0.1" build/test/functional/interface_http.py
Replace `time.time()` used to measure durations by `time.monotonic()` in test framework and http_interface. This helps preventing future clock jump flakiness (same class of bug as #36529) on tests and fix: ``` faketime --exclude-monotonic -f "+0 x0.5" build/test/functional/feature_torcontrol.py faketime --exclude-monotonic -f "+0 x0.1" build/test/functional/interface_http.py ```
DrahtBot commented 2026-11-02 13:06:34 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK nervana21, maflcko, sedited

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36731 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36731.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36731#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [nervana21](https://github.com/bitcoin/bitcoin/pull/36731#issuecomment-6675432663), [maflcko](https://github.com/bitcoin/bitcoin/pull/36731#issuecomment-6680123413), [sedited](https://github.com/bitcoin/bitcoin/pull/36731#pullrequestreview-5798578663) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

No verified findings are available from this review.

Review coverage was incomplete.


Reviewed: a7d3a4297321 · Full review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:965af1044d9e41839565702e4d9bd0a751eda81f6e8b6402747fa296ef84ebea:7efd3c3ba41667382004cfa7a7db56605da7d8f9b7ab69bc483f27117390ba48 --> <!-- ralph-base:e310efb202bd1283bcdd25d5748078df1219c8ac --> <!-- ralph-head:a7d3a4297321274ced64294e0bbd3252167e8879 --> <!-- ralph-case:148bd7f92f6caa0b116a4701b2e8f373b60b61ee274f5dd71d548a8a79966ba1 --> No verified findings are available from this review. Review coverage was incomplete. <!-- Review tier: standard --> --- Reviewed: [`a7d3a4297321`](<https://git.fish.foo/bitcoin/bitcoin/commit/a7d3a4297321274ced64294e0bbd3252167e8879>) · [Full review report](<https://review.fish.foo/traces/36731-a7d3a4297321274ced64294e0bbd3252167e8879-1981-1.html>) · [Previous reports](<https://review.fish.foo/traces/36731/>) [permalink](<https://review.fish.foo/traces/36731-a7d3a4297321274ced64294e0bbd3252167e8879-1981-1.html>)
nervana21 commented 2026-11-02 16:03:58 +00:00 (Migrated from github.com)
Concept ACK read my mind https://github.com/nervana21/bitcoin/tree/test-monotonic-wait-deadlines
nervana21 commented 2026-11-06 02:43:18 +00:00 (Migrated from github.com)

tACK a7d3a42973

I used a method similar to OP's and got the same results.

Could we also fix interface_ipc_mining? I think it has the same class of bug.

tACK a7d3a4297321274ced64294e0bbd3252167e8879 I used a method similar to OP's and got the same results. Could we also fix `interface_ipc_mining`? I think it has the same class of bug.
maflcko commented 2026-11-06 07:58:23 +00:00 (Migrated from github.com)

review ACK a7d3a42973 🕐

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK a7d3a4297321274ced64294e0bbd3252167e8879 🕐
puDsm8LL3f0RXsyvtA9LpCAai3+CTZRm7473NZhf3jtadtINbCd5JGfKcZ+zizcOnvTT2SnPoKs9piiKTWnIDA==
review ACK a7d3a4297321274ced64294e0bbd3252167e8879 🕐 <details><summary>Show signature</summary> Signature: ``` untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}" RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM= trusted comment: review ACK a7d3a4297321274ced64294e0bbd3252167e8879 🕐 puDsm8LL3f0RXsyvtA9LpCAai3+CTZRm7473NZhf3jtadtINbCd5JGfKcZ+zizcOnvTT2SnPoKs9piiKTWnIDA== ``` </details>
sedited (Migrated from github.com) approved these changes 2026-11-06 10:03:15 +00:00
sedited (Migrated from github.com) left a comment
ACK a7d3a4297321274ced64294e0bbd3252167e8879
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36731
No description provided.