-
Notifications
You must be signed in to change notification settings - Fork 140
CBG-4915: Fix flakiness of TestMultiActorLosingConflictUpdateRemovingAttachments
#7923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes flakiness in the TestMultiActorLosingConflictUpdateRemovingAttachments test by replacing require.EventuallyWithT with RestTester.WaitForVersion() to properly wait for document replication.
Key Changes:
- Replaced manual polling loop with built-in
WaitForVersionmethod for more reliable synchronization
| rtBVersion, _ := rtB.GetDoc(docID) | ||
|
|
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error return value from GetDoc is being silently discarded. Consider handling the error or using require.NoError(t, err) to ensure the document retrieval succeeds before proceeding with the test.
| rtBVersion, _ := rtB.GetDoc(docID) | |
| rtBVersion, err := rtB.GetDoc(docID) | |
| require.NoError(t, err) |
| rtB.WaitForVersion(docID, rtAVersion) | ||
| rtBVersion, _ := rtB.GetDoc(docID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think given this assertion, that rtBVersion and rtAVersion are the same.
I would perhaps assert that the version has CV and Revtree.
It is possible that this assertion will only work on CV, which will wait for the document to be copied (CV matches) but not imported.
I haven't looked into this, but we can discuss.
| assert.EventuallyWithT(t, func(c *assert.CollectT) { | ||
| currentRtAVersion, _ := rtA.GetDoc(docID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to get changed too
| require.NoError(t, xdcrAtoB.Stop(ctx)) | ||
| require.NoError(t, xdcrBtoA.Stop(ctx)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move these to a defer. In the case of rosmar, the xdcr replications will stop when the buckets disappear but in CBS they won't, and so this could leak into future tests.
Maybe this is actually already handled by defer at the top.
CBG-4915
Describe your PR here...
require.EventuallyWithTeven though the condition is not completely metRestTester'sWaitForVersionmethod insteadPre-review checklist
fmt.Print,log.Print, ...)base.UD(docID),base.MD(dbName))docs/apiDependencies (if applicable)
Integration Tests
GSI=true,xattrs=truehttps://jenkins.sgwdev.com/job/SyncGatewayIntegration/0000/