Skip to content

Commit

Permalink
CBG-4527 deflake TestOnDemandImportBlipFailure
Browse files Browse the repository at this point in the history
norev messages are sent with noreply, so it is possible for the marker
documents rev being processed before the preceding norev is stored

Use WaitForBlipRevMessage rather than a marker document, which doesn't
work if any messages are noreply.
  • Loading branch information
torcolvin committed Feb 26, 2025
1 parent 4962557 commit b7ef692
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions rest/blip_api_crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3079,7 +3079,6 @@ func TestOnDemandImportBlipFailure(t *testing.T) {
for i, testCase := range testCases {
rt.Run(testCase.name, func(t *testing.T) {
docID := fmt.Sprintf("doc%d_%s,", i, testCase.name)
markerDoc := fmt.Sprintf("markerDoc%d_%s", i, testCase.name)
validBody := fmt.Sprintf(`{"foo":"bar", "channel":%q}`, testCase.channel)
username := fmt.Sprintf("user_%d", i)

Expand All @@ -3096,8 +3095,6 @@ func TestOnDemandImportBlipFailure(t *testing.T) {
err := rt.GetSingleDataStore().SetRaw(docID, 0, nil, testCase.updatedBody)
require.NoError(t, err)

markerDocBody := fmt.Sprintf(`{"channel":%q}`, testCase.channel)
_ = rt.PutDoc(markerDoc, markerDocBody)
rt.WaitForPendingChanges()
rt.GetDatabase().FlushRevisionCacheForTest()

Expand All @@ -3110,13 +3107,8 @@ func TestOnDemandImportBlipFailure(t *testing.T) {

btcRunner.StartOneshotPull(btc2.id)

btcRunner.WaitForDoc(btc2.id, markerDoc)

// Validate that the latest client message for the requested doc/rev was a norev
msg, ok := btcRunner.SingleCollection(btc2.id).GetBlipRevMessage(docID, revID)
require.True(t, ok, "All messages=#+v", btcRunner.SingleCollection(btc2.id).parent.pullReplication.GetMessages())
msg := btcRunner.WaitForBlipRevMessage(btc2.id, docID, revID)
require.Equal(t, db.MessageNoRev, msg.Profile())

})
}
})
Expand Down

0 comments on commit b7ef692

Please sign in to comment.