test(integration): fix flaky test_delete_network batch race - #399
Merged
Conversation
test_delete_network retries createOrganizationActionBatch up to 5 times, but action batches are asynchronous: a prior attempt's batch can finish deleting the network after the test stops polling. The next attempt then hits 400 "Network not found", flaking the suite (#393, #394, #395). A delete is idempotent, so a 400 not-found on the create call means the network is already gone, which is the desired end state. Catch it and return success in both the sync and async lifecycle tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
test_delete_networkhas flaked on three recent dependabot PRs (#393, #394, #395) with:Root cause
The test retries
createOrganizationActionBatchup to 5 times. Action batches are asynchronous/eventually-consistent: a prior attempt's batch can finish deleting the network after the test stops polling its status. The next attempt then references a network that's already gone → 400 "not found".The
networkfixture has no teardown, so this test is the sole deleter — the only way the network can be absent on attempt N>1 is that attempt N-1 already deleted it.Fix
A delete is idempotent. A 400 not-found on the create call means the network is already gone, which is the desired end state → return success. Applied to both sync and async lifecycle tests.
🤖 Generated with Claude Code