Skip to content
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

refactor blip test client #7398

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions rest/attachment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2428,9 +2428,7 @@ func TestAttachmentWithErroneousRevPos(t *testing.T) {
btcRunner.WaitForVersion(btc.id, docID, version)

// Add an attachment to client
btcRunner.AttachmentsLock(btc.id).Lock()
btcRunner.Attachments(btc.id)["sha1-l+N7VpXGnoxMm8xfvtWPbz2YvDc="] = []byte("goodbye cruel world")
btcRunner.AttachmentsLock(btc.id).Unlock()
btcRunner.saveAttachment(btc.id, base64.StdEncoding.EncodeToString([]byte("goodbye cruel world")))

// Put doc with an erroneous revpos 1 but with a different digest, referring to the above attachment
updatedVersion, err := btcRunner.PushRevWithHistory(btc.id, docID, &version, []byte(`{"_attachments": {"hello.txt": {"revpos":1,"stub":true,"length": 19,"digest":"sha1-l+N7VpXGnoxMm8xfvtWPbz2YvDc="}}}`), 1, 0)
Expand Down
8 changes: 4 additions & 4 deletions rest/blip_api_crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ func TestSendReplacementRevision(t *testing.T) {

// one shot or else we'll carry on to send rev 2-... normally, and we can't assert correctly on the final state of the client
rt.WaitForPendingChanges()
btcRunner.StartOneshotPullFiltered(btc.id, replicationChannels)
btcRunner.StartPullSince(btc.id, BlipTesterPullOptions{Channels: replicationChannels, Continuous: false})

// block until we've written the update and got the new version to use in assertions
version2 := <-updatedVersion
Expand Down Expand Up @@ -2270,7 +2270,7 @@ func TestRemovedMessageWithAlternateAccessAndChannelFilteredReplication(t *testi
assert.Equal(t, docID, changes.Results[0].ID)
RequireChangeRevVersion(t, version, changes.Results[0].Changes[0])

btcRunner.StartOneshotPullFiltered(btc.id, "A")
btcRunner.StartPullSince(btc.id, BlipTesterPullOptions{Channels: "A", Continuous: false})
_ = btcRunner.WaitForVersion(btc.id, docID, version)

_ = rt.UpdateDoc(docID, version, `{"channels": ["B"]}`)
Expand All @@ -2285,7 +2285,7 @@ func TestRemovedMessageWithAlternateAccessAndChannelFilteredReplication(t *testi
assert.Equal(t, "doc", changes.Results[0].ID)
assert.Equal(t, markerID, changes.Results[1].ID)

btcRunner.StartOneshotPullFiltered(btc.id, "A")
btcRunner.StartPullSince(btc.id, BlipTesterPullOptions{Channels: "A", Continuous: false})
_ = btcRunner.WaitForVersion(btc.id, markerID, markerVersion)

messages := btc.pullReplication.GetMessages()
Expand Down Expand Up @@ -2879,7 +2879,7 @@ func TestRequestPlusPull(t *testing.T) {
caughtUpStart := database.DbStats.CBLReplicationPull().NumPullReplTotalCaughtUp.Value()

// Start a regular one-shot pull
btcRunner.StartOneshotPullRequestPlus(client.id)
btcRunner.StartPullSince(client.id, BlipTesterPullOptions{Continuous: true, RequestPlus: true})

// Wait for the one-shot changes feed to go into wait mode before releasing the slow sequence
require.NoError(t, database.WaitForTotalCaughtUp(caughtUpStart+1))
Expand Down
Loading
Loading