Skip to content

test: pass timeout=200 to ServiceInfo-request timeout tests#1677

Merged
bdraco merged 2 commits into
masterfrom
speedup-3s-timeout-tests
May 15, 2026
Merged

test: pass timeout=200 to ServiceInfo-request timeout tests#1677
bdraco merged 2 commits into
masterfrom
speedup-3s-timeout-tests

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented May 15, 2026

Summary

Three tests were each taking ~3 seconds because they relied on
the default 3000ms ServiceInfo request timeout to lapse:

  • test_request_timeout (tests/services/test_info.py)
  • test_async_request_timeout (tests/test_asyncio.py)
  • test_unicast_flag_if_requested (tests/services/test_info.py)

Pass timeout=200 explicitly so the request fails over in ~0.2s
instead of ~3s.

Details

  • The first two tests assert the elapsed time is close to the
    requested timeout — the property is "the timeout returns
    roughly when asked, plus slack for scheduler overhead." The
    assertion bound moves from < 3000 + 1000 to < 200 + 1000
    so the property is preserved at the new (smaller) timeout.
  • test_unicast_flag_if_requested only cares that every outgoing
    question has question.unicast set; the timeout value is
    irrelevant to what it pins.

Combined wall time across the three goes from ~9s to ~0.75s.

Two other 3.01s tests in the same family
(test_we_try_four_times_with_random_delay,
test_get_info_suppressed_by_question_history) are not
included here — they encode assumptions about retry counts /
question-history windows that are tied to the production timing
constants and need a separate fix.

Test plan

  • poetry run pytest tests/services/test_info.py::test_request_timeout tests/services/test_info.py::test_unicast_flag_if_requested tests/test_asyncio.py::test_async_request_timeout
    passes in 0.75s combined (was ~9s).
  • Pre-commit (ruff, mypy, etc.) clean.

Three tests were each taking ~3 seconds because they relied on
the default 3000ms ServiceInfo request timeout to lapse:

- test_request_timeout (tests/services/test_info.py)
- test_async_request_timeout (tests/test_asyncio.py)
- test_unicast_flag_if_requested (tests/services/test_info.py)

Pass `timeout=200` explicitly so the request fails over in ~0.2s
instead of ~3s. The first two assert the elapsed time is close
to the requested timeout; the assertion bound moves from
`< 3000 + 1000` to `< 200 + 1000` so the property under test
(timeout returns roughly when asked, plus a slack for scheduler
overhead) is preserved.

Combined wall time across the three goes from ~9s to ~0.75s.
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 15, 2026

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing speedup-3s-timeout-tests (0bac67a) with master (cbdc404)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (dd8ede3) during the generation of this report, so cbdc404 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.76%. Comparing base (dd8ede3) to head (0bac67a).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1677   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files          33       33           
  Lines        3401     3401           
  Branches      461      461           
=======================================
  Hits         3393     3393           
  Misses          5        5           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bdraco bdraco merged commit 01ef6ff into master May 15, 2026
39 checks passed
@bdraco bdraco deleted the speedup-3s-timeout-tests branch May 15, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant