Skip to content

test: replace fixed sleep with poll_until_condition in test_cache_initialization#882

Merged
vdusek merged 1 commit intomasterfrom
fix/cache-initialization-test-flakiness
Apr 29, 2026
Merged

test: replace fixed sleep with poll_until_condition in test_cache_initialization#882
vdusek merged 1 commit intomasterfrom
fix/cache-initialization-test-flakiness

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented Apr 29, 2026

Summary

Fixes flakiness in test_cache_initialization (integration tests, see run 25099976014).

The test used fixed asyncio.sleep(10) waits to give Apify platform stats time to propagate. In CI, 10s wasn't always enough — read_count was still 0 after the second sleep, so the assertion failed even though the cache had been initialized correctly.

Switched to the existing poll_until_condition helper (already used elsewhere in this file for the same purpose). It calls get_metadata immediately, then polls every 5s up to a 60s timeout — faster in the happy path, more tolerant of platform lag in the slow path. Real regressions still fail the test; only the propagation-timing flake is masked.

…tialization

The fixed `asyncio.sleep(10)` waits weren't always enough for Apify platform
stats to propagate, causing intermittent CI failures. Switch to the existing
`poll_until_condition` helper used elsewhere in the file.
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Apr 29, 2026
@vdusek vdusek self-assigned this Apr 29, 2026
@github-actions github-actions Bot added this to the 139th sprint - Tooling team milestone Apr 29, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Apr 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.01%. Comparing base (a57fcd3) to head (8f14d98).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #882      +/-   ##
==========================================
- Coverage   87.04%   87.01%   -0.04%     
==========================================
  Files          48       48              
  Lines        2942     2942              
==========================================
- Hits         2561     2560       -1     
- Misses        381      382       +1     
Flag Coverage Δ
e2e 37.72% <ø> (ø)
integration 59.04% <ø> (-0.04%) ⬇️
unit 75.76% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@vdusek vdusek merged commit c522b1a into master Apr 29, 2026
31 checks passed
@vdusek vdusek deleted the fix/cache-initialization-test-flakiness branch April 29, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants