Skip to content

test: stabilize test_actor_last_run against concurrent run deletions - #1190

Merged
vdusek merged 1 commit into
masterfrom
test/fix-flaky-actor-last-run
Nov 2, 2026
Merged

vdusek merged 1 commit into
masterfrom
test/fix-flaky-actor-last-run

Conversation

@vdusek

@vdusek vdusek commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

test_actor_last_run failed on master (CI run) because last_run().get() returned None right after the test's own call() finished.

The API serves runs/last in two steps. It looks up the newest non-deleted run, then forwards the request to GET /runs/{id}. Parallel integration tests on the same account keep finishing and deleting apify/hello-world runs. When the newest run belongs to a sibling test and gets deleted between those two steps, the API answers 404. Locally, with a background loop finishing and deleting runs, about 1 in 1000 last_run().get() calls returned None.

The test now polls until it gets a run that started no earlier than its own, the same approach test_task_last_run uses. Its own run stays alive until cleanup, so the condition always holds eventually. It also asserts started_at instead of only checking that id is set.

✍️ Drafted by Claude Code

@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 Nov 2, 2026
@vdusek vdusek self-assigned this Nov 2, 2026
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.66%. Comparing base (6821b46) to head (6f34f2f).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1190      +/-   ##
==========================================
+ Coverage   90.35%   95.66%   +5.30%     
==========================================
  Files          61       61              
  Lines        6461     6461              
==========================================
+ Hits         5838     6181     +343     
+ Misses        623      280     -343     
Flag Coverage Δ
integration 91.05% <ø> (?)
unit 90.35% <ø> (ø)

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

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek requested a review from apify-factory November 2, 2026 09:18
@vdusek
vdusek marked this pull request as ready for review November 2, 2026 09:18
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Nov 2, 2026

@apify-factory apify-factory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nothing blocking.

🏭 Apify Factory auto approved ✅ — every gate opened, nobody had to knock

Every gate passed, and neither the reviewer nor a juror found anything a human needs to look at.

Approval locked to 6f34f2f86 · workflow run

@vdusek
vdusek merged commit cbed860 into master Nov 2, 2026
40 of 43 checks passed
@vdusek
vdusek deleted the test/fix-flaky-actor-last-run branch November 2, 2026 09:21
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.

3 participants