test: deflake test_actor_create_update_delete against retried create conflict - #971
Draft
vdusek wants to merge 5 commits into
Draft
test: deflake test_actor_create_update_delete against retried create conflict#971vdusek wants to merge 5 commits into
vdusek wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #971 +/- ##
==========================================
+ Coverage 94.64% 94.71% +0.06%
==========================================
Files 58 58
Lines 5248 5259 +11
==========================================
+ Hits 4967 4981 +14
+ Misses 281 278 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vdusek
marked this pull request as ready for review
July 21, 2026 08:14
Pijukatel
approved these changes
Jul 23, 2026
vdusek
marked this pull request as draft
August 3, 2026 11:22
Contributor
Author
|
converting to draft as I'm not sure whether these test utils are worth it, let me @Pijukatel know WDYT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The integration test
test_actor_create_update_deleteintermittently failed withConflictError: Some other Actor already has this name, e.g. in this CI run (on an unrelated Renovate PR).Root cause: the HTTP client retries every request on transient 5xx and network errors (
max_retries=8). APOST /v2/actorscreate can commit server-side on one attempt yet still be retried; the retry then hits a 409 on the unique name it just created. The failing traceback showsattempt=2, and the 61^8 random resource name rules out cross-worker or leftover collisions.Create calls in the integration tests now go through conflict-recovering helpers in
tests/_utils.py. On the API error that signals a lost name or version number, the helper fetches what the first attempt committed and the test continues. Anything else propagates, and so does a matching error whose resource cannot be found afterwards - a genuine create failure still fails the test rather than being masked.This covers every create of a resource with a uniqueness constraint: Actors (
actor-name-not-unique), tasks (actor-task-name-not-unique), schedules (schedule-name-not-unique), Actor versions (version-already-exists) and env vars (env-var-already-exists). Webhooks have no name uniqueness, and the dataset/KVS/queue creates useget_or_create, so neither needs a helper.The recovery branches only run when a retried create already committed, which never happens in a normal integration run.
tests/unit/test_create_helpers.pytherefore drives each helper against a mocked API, so a wrong error type or lookup route is caught there instead of resurfacing as the flake the helpers exist to prevent.This is a test-side fix. The underlying client behaviour - retrying non-idempotent requests - is tracked in #990; besides these spurious conflicts it can also silently duplicate run starts and webhook creations for callers.
✍️ Drafted by Claude Code