Fix flaky TestConcurrentDeletes e2e test#1001
Merged
Merged
Conversation
Signed-off-by: liamfallon <liam.fallon@est.tech>
Contributor
There was a problem hiding this comment.
Pull request overview
Relaxes the TestConcurrentDeletes e2e test expectations to reduce CI flakiness by accepting additional valid outcomes from losing concurrent delete requests (e.g., NotFound / DB “no rows” style errors) while still requiring at least one successful delete and verifying the resource is gone.
Changes:
- Switch
TestConcurrentDeletesto a delete-specific concurrency assertion helper. - Add
assertConcurrentDeleteResultsto treat conflict, not-found, and “sql: no rows in result set” as acceptable losing outcomes for concurrent deletes.
JamesMcDermott
approved these changes
May 20, 2026
aravindtga
approved these changes
May 20, 2026
efiacor
approved these changes
May 20, 2026
thc1006
added a commit
to thc1006/porch
that referenced
this pull request
May 21, 2026
Sync with latest main to pick up kptdev#1001 (flaky TestConcurrentDeletes fix) and trigger a fresh CI run after the flaky rpkg-get CLI E2E timeout on the DB cache backend. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.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.
Fix flaky TestConcurrentDeletes e2e test
Description
Type of Change
Checklist
AI Disclosure
I used the solution suggested by CoPilot in Github when I asked it to "fix with Copilot"
Copilot dialogue transcript
The failure is in TestE2E/TestConcurrentDeletes in test/e2e/api/concurrent_test.go at #L343-L349, triggered by the E2E workflow job definition in .github/workflows/porch-e2e-ci-jobs.yaml#L175-L176.
What failed
The test currently assumes that concurrent deletes must produce:
But the actual results in the log were:
So one request succeeded, but the losing requests no longer consistently return the expected conflict string. That makes the test too strict and flaky against the current backend behavior, especially in the DB-cache path.
Best fix
Make the delete concurrency assertion accept the set of valid losing outcomes for concurrent delete:
This keeps the test focused on the real invariant: exactly one delete wins, and the object is gone at the end.
Suggested code change
Update assertConcurrentResults to allow operation-specific acceptable errors, or special-case delete.
Example minimal patch:
Go
func (t *PorchSuite) assertConcurrentResults(results []any, operation string) {
assert.Contains(t, results, nil, "expected one %s request to succeed, but did not happen - results: %v", operation, results)
}
Better version
If you want cleaner semantics, split delete into its own assertion:
Go
func (t *PorchSuite) assertConcurrentDeleteResults(results []any) {
assert.Contains(t, results, nil, "expected one delete request to succeed, but did not happen - results: %v", results)
}
Then change TestConcurrentDeletes from:
Go
t.assertConcurrentResults(results, "delete")
to:
Go
t.assertConcurrentDeleteResults(results)
Why this is the right solution
For concurrent delete, once one request removes the object, other in-flight requests may observe:
Those are all valid race outcomes. Requiring only one exact error string makes the test assert implementation details instead of behavior.
Files to update
Recommended final adjustment
Keep these two assertions in TestConcurrentDeletes:
Relax only the expected loser error shape. That should make the failing job stable without weakening the actual concurrency guarantee.