Skip to content

test: fix race in test_register_and_lookup_type_by_uppercase_name - #1712

Merged
bdraco merged 1 commit into
masterfrom
fix/test-uppercase-lookup-race
May 18, 2026
Merged

bdraco merged 1 commit into
masterfrom
fix/test-uppercase-lookup-race

Conversation

@bdraco

@bdraco bdraco commented May 18, 2026

Copy link
Copy Markdown
Member

Summary

test_register_and_lookup_type_by_uppercase_name has a long-standing race that surfaced on the PR #1710 CI run for the pypy-3.10 / ubuntu / skip_cython matrix entry. The cache-poll loop:

for _ in range(50):
    time.sleep(0.02)
    info.load_from_cache(zc)
    if info.addresses:
        break
assert info.addresses == [socket.inet_pton(socket.AF_INET, "1.2.3.4")]
assert info.properties == {b"version": b"1.0"}

breaks on the A record landing, but the next assertion checks the TXT record, which arrives via a separate cache update. Under PyPy / skip_cython the listener occasionally schedules the assertions between the two updates, leaving info.properties == {}.

Fix: require both before exiting the loop.

if info.addresses and info.properties:
    break

The race predates and is not specific to PR #1710 — same flakiness class hit a recent master run on a different test (test_service_browser_expire_callbacks).

Test plan

  • Targeted test passes locally
  • Pre-commit hooks pass

…e_by_uppercase_name

The cache-poll loop broke on `info.addresses` (A record) but the
next assertion checks `info.properties` (a separate TXT record
that arrives via its own cache update). On PyPy / skip_cython
the listener occasionally schedules the assertions between the
two, leaving `info.properties == {}`. Tighten the break condition
to require both before exiting the loop.

Hit on the PR #1710 CI run for pypy-3.10/ubuntu/skip_cython but the
race predates that PR and is not specific to it.
@codspeed

codspeed Bot commented May 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing fix/test-uppercase-lookup-race (e12cd80) with master (4bae30a)

Open in CodSpeed

@bdraco
bdraco merged commit 91aa21d into master May 18, 2026
31 checks passed
@bdraco
bdraco deleted the fix/test-uppercase-lookup-race branch May 18, 2026 00:45
@codecov

codecov Bot commented May 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.76%. Comparing base (4bae30a) to head (e12cd80).
⚠️ Report is 73 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1712   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files          33       33           
  Lines        3426     3426           
  Branches      471      471           
=======================================
  Hits         3418     3418           
  Misses          5        5           
  Partials        3        3           

☔ View full report in Codecov by Harness.
📢 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.

This branch had an error being deployed

1 failed deployment
release — e12cd807 Deployed May 18, 2026 by bdraco via release #5300
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