From 1ac3b1ac4beebc18eed3840567edc674227660f4 Mon Sep 17 00:00:00 2001 From: Gregory Newman-Smith Date: Tue, 7 Nov 2023 12:06:04 +0000 Subject: [PATCH] updates to work with rebase changes --- rest/attachment_test.go | 34 +++++++++--------- rest/blip_api_attachment_test.go | 37 +++++++++----------- rest/blip_api_collections_test.go | 28 +++++++-------- rest/blip_api_crud_test.go | 58 +++++++++++++++++-------------- rest/blip_api_delta_sync_test.go | 49 +++++++++++++------------- rest/blip_client_test.go | 10 +++--- rest/revocation_test.go | 26 +++++++------- 7 files changed, 121 insertions(+), 121 deletions(-) diff --git a/rest/attachment_test.go b/rest/attachment_test.go index 3389ea26ee..5ddba6691c 100644 --- a/rest/attachment_test.go +++ b/rest/attachment_test.go @@ -2276,8 +2276,8 @@ func TestUpdateExistingAttachment(t *testing.T) { btc.Run(func(t *testing.T) { // Add doc1 and doc2 - doc1Version := rt.PutDoc(doc1ID, `{}`) - doc2Version := rt.PutDoc(doc2ID, `{}`) + doc1Version := btc.rt.PutDoc(doc1ID, `{}`) + doc2Version := btc.rt.PutDoc(doc2ID, `{}`) require.NoError(t, btc.rt.WaitForPendingChanges()) @@ -2296,8 +2296,8 @@ func TestUpdateExistingAttachment(t *testing.T) { doc2Version, err = btc.PushRev("doc2", doc2Version, []byte(`{"key": "val", "_attachments": {"attachment": {"data": "`+attachmentBData+`"}}}`)) require.NoError(t, err) - assert.NoError(t, rt.WaitForVersion(doc1ID, doc1Version)) - assert.NoError(t, rt.WaitForVersion(doc2ID, doc2Version)) + assert.NoError(t, btc.rt.WaitForVersion(doc1ID, doc1Version)) + assert.NoError(t, btc.rt.WaitForVersion(doc2ID, doc2Version)) _, err = btc.rt.GetSingleTestDatabaseCollection().GetDocument(base.TestCtx(t), "doc1", db.DocUnmarshalAll) require.NoError(t, err) @@ -2307,7 +2307,7 @@ func TestUpdateExistingAttachment(t *testing.T) { doc1Version, err = btc.PushRev("doc1", doc1Version, []byte(`{"key": "val", "_attachments":{"attachment":{"digest":"sha1-SKk0IV40XSHW37d3H0xpv2+z9Ck=","length":11,"content_type":"","stub":true,"revpos":3}}}`)) require.NoError(t, err) - assert.NoError(t, rt.WaitForVersion(doc1ID, doc1Version)) + assert.NoError(t, btc.rt.WaitForVersion(doc1ID, doc1Version)) doc1, err := btc.rt.GetSingleTestDatabaseCollection().GetDocument(base.TestCtx(t), "doc1", db.DocUnmarshalAll) assert.NoError(t, err) @@ -2333,7 +2333,7 @@ func TestPushUnknownAttachmentAsStub(t *testing.T) { btc.Run(func(t *testing.T) { // Add doc1 and doc2 - doc1Version := rt.PutDoc(doc1ID, `{}`) + doc1Version := btc.rt.PutDoc(doc1ID, `{}`) require.NoError(t, btc.rt.WaitForPendingChanges()) @@ -2353,7 +2353,7 @@ func TestPushUnknownAttachmentAsStub(t *testing.T) { doc1Version, err = btc.PushRev(doc1ID, doc1Version, []byte(fmt.Sprintf(`{"key": "val", "_attachments":{"attachment":{"digest":"%s","length":%d,"content_type":"%s","stub":true,"revpos":1}}}`, digest, length, contentType))) require.NoError(t, err) - require.NoError(t, rt.WaitForVersion(doc1ID, doc1Version)) + require.NoError(t, btc.rt.WaitForVersion(doc1ID, doc1Version)) // verify that attachment exists on document and was persisted attResponse := btc.rt.SendAdminRequest("GET", "/{{.keyspace}}/doc1/attachment", "") @@ -2380,8 +2380,8 @@ func TestMinRevPosWorkToAvoidUnnecessaryProveAttachment(t *testing.T) { btc.Run(func(t *testing.T) { // Push an initial rev with attachment data - initialVersion := rt.PutDoc(docID, `{"_attachments": {"hello.txt": {"data": "aGVsbG8gd29ybGQ="}}}`) - err = rt.WaitForPendingChanges() + initialVersion := btc.rt.PutDoc(docID, `{"_attachments": {"hello.txt": {"data": "aGVsbG8gd29ybGQ="}}}`) + err := btc.rt.WaitForPendingChanges() assert.NoError(t, err) // Replicate data to client and ensure doc arrives @@ -2416,8 +2416,8 @@ func TestAttachmentWithErroneousRevPos(t *testing.T) { btc.Run(func(t *testing.T) { // Create rev 1 with the hello.txt attachment const docID = "doc" - version := rt.PutDoc(docID, `{"val": "val", "_attachments": {"hello.txt": {"data": "aGVsbG8gd29ybGQ="}}}`) - err := rt.WaitForPendingChanges() + version := btc.rt.PutDoc(docID, `{"val": "val", "_attachments": {"hello.txt": {"data": "aGVsbG8gd29ybGQ="}}}`) + err := btc.rt.WaitForPendingChanges() assert.NoError(t, err) // Pull rev and attachment down to client @@ -2597,9 +2597,9 @@ func TestCBLRevposHandling(t *testing.T) { ) btc.Run(func(t *testing.T) { - doc1Version := rt.PutDoc(doc1ID, `{}`) - doc2Version := rt.PutDoc(doc2ID, `{}`) - require.NoError(t, rt.WaitForPendingChanges()) + doc1Version := btc.rt.PutDoc(doc1ID, `{}`) + doc2Version := btc.rt.PutDoc(doc2ID, `{}`) + require.NoError(t, btc.rt.WaitForPendingChanges()) err := btc.StartOneshotPull() assert.NoError(t, err) @@ -2616,8 +2616,8 @@ func TestCBLRevposHandling(t *testing.T) { doc2Version, err = btc.PushRev(doc2ID, doc2Version, []byte(`{"key": "val", "_attachments": {"attachment": {"data": "`+attachmentBData+`"}}}`)) require.NoError(t, err) - assert.NoError(t, rt.WaitForVersion(doc1ID, doc1Version)) - assert.NoError(t, rt.WaitForVersion(doc2ID, doc2Version)) + assert.NoError(t, btc.rt.WaitForVersion(doc1ID, doc1Version)) + assert.NoError(t, btc.rt.WaitForVersion(doc2ID, doc2Version)) _, err = btc.rt.GetSingleTestDatabaseCollection().GetDocument(base.TestCtx(t), "doc1", db.DocUnmarshalAll) require.NoError(t, err) @@ -2628,7 +2628,7 @@ func TestCBLRevposHandling(t *testing.T) { doc1Version, err = btc.PushRev(doc1ID, doc1Version, []byte(`{"key": "val", "_attachments":{"attachment":{"digest":"sha1-wzp8ZyykdEuZ9GuqmxQ7XDrY7Co=","length":11,"content_type":"","stub":true,"revpos":2}}}`)) require.NoError(t, err) - assert.NoError(t, rt.WaitForVersion(doc1ID, doc1Version)) + assert.NoError(t, btc.rt.WaitForVersion(doc1ID, doc1Version)) // Update doc1, don't change attachment, use revpos=generation of revid, as CBL 2.x does. Should not proveAttachment on digest match. doc1Version, err = btc.PushRev(doc1ID, doc1Version, []byte(`{"key": "val", "_attachments":{"attachment":{"digest":"sha1-wzp8ZyykdEuZ9GuqmxQ7XDrY7Co=","length":11,"content_type":"","stub":true,"revpos":4}}}`)) diff --git a/rest/blip_api_attachment_test.go b/rest/blip_api_attachment_test.go index 91cfdb2de2..d7f9da59d5 100644 --- a/rest/blip_api_attachment_test.go +++ b/rest/blip_api_attachment_test.go @@ -58,7 +58,7 @@ func TestBlipPushPullV2AttachmentV2Client(t *testing.T) { // Create doc revision with attachment on SG. bodyText := `{"greetings":[{"hi": "alice"}],"_attachments":{"hello.txt":{"data":"aGVsbG8gd29ybGQ="}}}` - version := rt.PutDoc(docID, bodyText) + version := btc.rt.PutDoc(docID, bodyText) data, ok := btc.WaitForVersion(docID, version) assert.True(t, ok) @@ -74,7 +74,7 @@ func TestBlipPushPullV2AttachmentV2Client(t *testing.T) { _, ok = btc.pushReplication.WaitForMessage(2) assert.True(t, ok) - respBody := rt.GetDocVersion(docID, version) + respBody := btc.rt.GetDocVersion(docID, version) assert.Equal(t, docID, respBody[db.BodyId]) greetings := respBody["greetings"].([]interface{}) @@ -125,7 +125,7 @@ func TestBlipPushPullV2AttachmentV3Client(t *testing.T) { // Create doc revision with attachment on SG. bodyText := `{"greetings":[{"hi": "alice"}],"_attachments":{"hello.txt":{"data":"aGVsbG8gd29ybGQ="}}}` - version := rt.PutDoc(docID, bodyText) + version := btc.rt.PutDoc(docID, bodyText) data, ok := btc.WaitForVersion(docID, version) assert.True(t, ok) @@ -141,7 +141,7 @@ func TestBlipPushPullV2AttachmentV3Client(t *testing.T) { _, ok = btc.pushReplication.WaitForMessage(2) assert.True(t, ok) - respBody := rt.GetDocVersion(docID, version) + respBody := btc.rt.GetDocVersion(docID, version) assert.Equal(t, docID, respBody[db.BodyId]) greetings := respBody["greetings"].([]interface{}) @@ -198,7 +198,7 @@ func TestBlipProveAttachmentV2(t *testing.T) { // Create two docs with the same attachment data on SG - v2 attachments intentionally result in two copies, // CBL will still de-dupe attachments based on digest, so will still try proveAttachmnet for the 2nd. doc1Body := fmt.Sprintf(`{"greetings":[{"hi": "alice"}],"_attachments":{"%s":{"data":"%s"}}}`, attachmentName, attachmentDataB64) - doc1Version := rt.PutDoc(doc1ID, doc1Body) + doc1Version := btc.rt.PutDoc(doc1ID, doc1Body) data, ok := btc.WaitForVersion(doc1ID, doc1Version) require.True(t, ok) @@ -207,9 +207,9 @@ func TestBlipProveAttachmentV2(t *testing.T) { // create doc2 now that we know the client has the attachment doc2Body := fmt.Sprintf(`{"greetings":[{"howdy": "bob"}],"_attachments":{"%s":{"data":"%s"}}}`, attachmentName, attachmentDataB64) - doc2Version := rt.PutDoc(doc2ID, doc2Body) + doc2Version := btc.rt.PutDoc(doc2ID, doc2Body) - data, ok = btc.WaitForRev(doc2ID, doc2RevID) + data, ok = btc.WaitForVersion(doc2ID, doc2Version) require.True(t, ok) bodyTextExpected = fmt.Sprintf(`{"greetings":[{"howdy":"bob"}],"_attachments":{"%s":{"revpos":1,"length":%d,"stub":true,"digest":"%s"}}}`, attachmentName, len(attachmentData), attachmentDigest) require.JSONEq(t, bodyTextExpected, string(data)) @@ -254,7 +254,7 @@ func TestBlipProveAttachmentV2Push(t *testing.T) { doc1Version, err := btc.PushRev(doc1ID, EmptyDocVersion(), []byte(doc1Body)) require.NoError(t, err) - err = rt.WaitForVersion(doc1ID, doc1Version) + err = btc.rt.WaitForVersion(doc1ID, doc1Version) require.NoError(t, err) // create doc2 now that we know the server has the attachment - SG should still request the attachment data from the client. @@ -262,7 +262,7 @@ func TestBlipProveAttachmentV2Push(t *testing.T) { doc2Version, err := btc.PushRev(doc2ID, EmptyDocVersion(), []byte(doc2Body)) require.NoError(t, err) - err = rt.WaitForVersion(doc2ID, doc2Version) + err = btc.rt.WaitForVersion(doc2ID, doc2Version) require.NoError(t, err) assert.Equal(t, int64(2), btc.rt.GetDatabase().DbStats.CBLReplicationPush().DocPushCount.Value()) @@ -292,9 +292,6 @@ func TestBlipPushPullNewAttachmentCommonAncestor(t *testing.T) { err = btc.StoreRevOnClient(docID, "2-abc", []byte(bodyText)) require.NoError(t, err) - response := btc.rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc/_blipsync", "") - fmt.Println(response.Code, response.Body.String()) - bodyText = `{"greetings":[{"hi":"alice"}],"_attachments":{"hello.txt":{"revpos":2,"length":11,"stub":true,"digest":"sha1-Kq5sNclPz7QV2+lfQIuc6R7oRu0="}}}` revId, err := btc.PushRevWithHistory(docID, "", []byte(bodyText), 2, 0) require.NoError(t, err) @@ -536,7 +533,7 @@ func TestBlipAttachNameChange(t *testing.T) { // Use revpos 2 to simulate revpos bug in CBL 2.8 - 3.0.0 version, err = client1.PushRev("doc", version, []byte(`{"key":"val","_attachments":{"attach":{"revpos":2,"content_type":"","length":11,"stub":true,"digest":"`+digest+`"}}}`)) require.NoError(t, err) - err = rt.WaitForVersion("doc", version) + err = client1.rt.WaitForVersion("doc", version) require.NoError(t, err) // Check if attachment is still in bucket @@ -571,10 +568,10 @@ func TestBlipLegacyAttachNameChange(t *testing.T) { CreateDocWithLegacyAttachment(t, client1.rt, docID, rawDoc, attKey, attBody) // Get the document and grab the revID. - docVersion, _ := rt.GetDoc(docID) + docVersion, _ := client1.rt.GetDoc(docID) // Store the document and attachment on the test client - err = client1.StoreRevOnClient(docID, docVersion.RevID, rawDoc) + err := client1.StoreRevOnClient(docID, docVersion.RevID, rawDoc) require.NoError(t, err) client1.AttachmentsLock().Lock() @@ -592,7 +589,7 @@ func TestBlipLegacyAttachNameChange(t *testing.T) { docVersion, err = client1.PushRev("doc", docVersion, []byte(`{"key":"val","_attachments":{"attach":{"revpos":2,"content_type":"test/plain","length":2,"stub":true,"digest":"`+digest+`"}}}`)) require.NoError(t, err) - err = rt.WaitForVersion("doc", docVersion) + err = client1.rt.WaitForVersion("doc", docVersion) require.NoError(t, err) resp := client1.rt.SendAdminRequest("GET", "/{{.keyspace}}/doc/attach", "") @@ -623,10 +620,10 @@ func TestBlipLegacyAttachDocUpdate(t *testing.T) { // Create a document with legacy attachment. CreateDocWithLegacyAttachment(t, client1.rt, docID, rawDoc, attKey, attBody) - version, _ := rt.GetDoc(docID) + version, _ := client1.rt.GetDoc(docID) // Store the document and attachment on the test client - err = client1.StoreRevOnClient(docID, version.RevID, rawDoc) + err := client1.StoreRevOnClient(docID, version.RevID, rawDoc) require.NoError(t, err) client1.AttachmentsLock().Lock() client1.Attachments()[digest] = attBody @@ -643,7 +640,7 @@ func TestBlipLegacyAttachDocUpdate(t *testing.T) { version, err = client1.PushRev("doc", version, []byte(`{"key":"val1","_attachments":{"`+attName+`":{"revpos":2,"content_type":"text/plain","length":2,"stub":true,"digest":"`+digest+`"}}}`)) require.NoError(t, err) - err = rt.WaitForVersion("doc", version) + err = client1.rt.WaitForVersion("doc", version) require.NoError(t, err) resp := client1.rt.SendAdminRequest("GET", fmt.Sprintf("/{{.keyspace}}/doc/%s", attName), "") @@ -692,7 +689,7 @@ func TestAttachmentComputeStat(t *testing.T) { // Create doc revision with attachment on SG. bodyText := `{"greetings":[{"hi": "alice"}],"_attachments":{"hello.txt":{"data":"aGVsbG8gd29ybGQ="}}}` - version := rt.PutDoc(docID, bodyText) + version := btc.rt.PutDoc(docID, bodyText) // Wait for the document to be replicated to client. data, ok := btc.WaitForVersion(docID, version) diff --git a/rest/blip_api_collections_test.go b/rest/blip_api_collections_test.go index 7b245788d9..0c038c7d37 100644 --- a/rest/blip_api_collections_test.go +++ b/rest/blip_api_collections_test.go @@ -31,7 +31,7 @@ func TestBlipGetCollections(t *testing.T) { rtConfig := &RestTesterConfig{GuestEnabled: true} btc := NewBlipTesterClientOptsWithRT(&BlipTesterClientOpts{ SkipCollectionsInitialization: true, - NumCollectionsNeeded: 1, + NumCollectionsRequired: 1, }) defer btc.Close() @@ -244,8 +244,8 @@ func TestCollectionsReplication(t *testing.T) { const docID = "doc1" btc.Run(func(t *testing.T) { - version := rt.PutDoc(docID, "{}") - require.NoError(t, rt.WaitForPendingChanges()) + version := btc.rt.PutDoc(docID, "{}") + require.NoError(t, btc.rt.WaitForPendingChanges()) btcCollection := btc.SingleCollection() @@ -262,19 +262,19 @@ func TestBlipReplicationMultipleCollections(t *testing.T) { GuestEnabled: true, } - btc := NewBlipTesterClientOptsWithRT(&BlipTesterClientOpts{NumCollectionsNeeded: 2}) + btc := NewBlipTesterClientOptsWithRT(&BlipTesterClientOpts{NumCollectionsRequired: 2}) defer btc.Close() btc.Run(func(t *testing.T) { docName := "doc1" body := `{"foo":"bar"}` - versions := make([]DocVersion, 0, len(rt.GetKeyspaces())) - for _, keyspace := range rt.GetKeyspaces() { - resp := rt.SendAdminRequest(http.MethodPut, "/"+keyspace+"/"+docName, `{"foo":"bar"}`) + versions := make([]DocVersion, 0, len(btc.rt.GetKeyspaces())) + for _, keyspace := range btc.rt.GetKeyspaces() { + resp := btc.rt.SendAdminRequest(http.MethodPut, "/"+keyspace+"/"+docName, `{"foo":"bar"}`) RequireStatus(t, resp, http.StatusCreated) versions = append(versions, DocVersionFromPutResponse(t, resp)) } - require.NoError(t, rt.WaitForPendingChanges()) + require.NoError(t, btc.rt.WaitForPendingChanges()) // start all the clients first for _, collectionClient := range btc.collectionClients { @@ -299,24 +299,24 @@ func TestBlipReplicationMultipleCollectionsMismatchedDocSizes(t *testing.T) { GuestEnabled: true, } - btc := NewBlipTesterClientOptsWithRT(&BlipTesterClientOpts{NumCollectionsNeeded: 2}) + btc := NewBlipTesterClientOptsWithRT(&BlipTesterClientOpts{NumCollectionsRequired: 2}) defer btc.Close() btc.Run(func(t *testing.T) { body := `{"foo":"bar"}` collectionDocIDs := make(map[string][]string) collectionVersions := make(map[string][]DocVersion) - require.Len(t, rt.GetKeyspaces(), 2) - for i, keyspace := range rt.GetKeyspaces() { + require.Len(t, btc.rt.GetKeyspaces(), 2) + for i, keyspace := range btc.rt.GetKeyspaces() { // intentionally create collections with different size replications to ensure one collection finishing won't cancel another one docCount := 10 if i == 0 { docCount = 1 } - blipName := rt.getCollectionsForBLIP()[i] + blipName := btc.rt.getCollectionsForBLIP()[i] for j := 0; j < docCount; j++ { docName := fmt.Sprintf("doc%d", j) - resp := rt.SendAdminRequest(http.MethodPut, "/"+keyspace+"/"+docName, body) + resp := btc.rt.SendAdminRequest(http.MethodPut, "/"+keyspace+"/"+docName, body) RequireStatus(t, resp, http.StatusCreated) version := DocVersionFromPutResponse(t, resp) @@ -324,7 +324,7 @@ func TestBlipReplicationMultipleCollectionsMismatchedDocSizes(t *testing.T) { collectionDocIDs[blipName] = append(collectionDocIDs[blipName], docName) } } - require.NoError(t, rt.WaitForPendingChanges()) + require.NoError(t, btc.rt.WaitForPendingChanges()) // start all the clients first for _, collectionClient := range btc.collectionClients { diff --git a/rest/blip_api_crud_test.go b/rest/blip_api_crud_test.go index b9dffc9b94..e4967258e3 100644 --- a/rest/blip_api_crud_test.go +++ b/rest/blip_api_crud_test.go @@ -1847,14 +1847,14 @@ func TestBlipPullRevMessageHistory(t *testing.T) { assert.NoError(t, err) // create doc1 rev 1-0335a345b6ffed05707ccc4cbc1b67f4 - version1 := rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) + version1 := client.rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) data, ok := client.WaitForVersion(docID, version1) assert.True(t, ok) assert.Equal(t, `{"greetings":[{"hello":"world!"},{"hi":"alice"}]}`, string(data)) // create doc1 rev 2-959f0e9ad32d84ff652fb91d8d0caa7e - version2 := rt.UpdateDoc(docID, version1, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}, {"howdy": 12345678901234567890}]}`) + version2 := client.rt.UpdateDoc(docID, version1, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}, {"howdy": 12345678901234567890}]}`) data, ok = client.WaitForVersion(docID, version2) assert.True(t, ok) @@ -1878,7 +1878,7 @@ func TestActiveOnlyContinuous(t *testing.T) { const docID = "doc1" btc.Run(func(t *testing.T) { - version := rt.PutDoc(docID, `{"test":true}`) + version := btc.rt.PutDoc(docID, `{"test":true}`) // start an initial pull require.NoError(t, btc.StartPullSince("true", "0", "true")) @@ -1887,7 +1887,7 @@ func TestActiveOnlyContinuous(t *testing.T) { assert.Equal(t, `{"test":true}`, string(rev)) // delete the doc and make sure the client still gets the tombstone replicated - deletedVersion := rt.DeleteDocReturnVersion(docID, version) + deletedVersion := btc.rt.DeleteDocReturnVersion(docID, version) rev, found = btc.WaitForVersion(docID, deletedVersion) assert.True(t, found) @@ -1963,9 +1963,13 @@ func TestRemovedMessageWithAlternateAccess(t *testing.T) { const docMarker = "docmarker" btc.Run(func(t *testing.T) { - version := rt.PutDoc(docID, `{"channels": ["A", "B"]}`) + collection := btc.rt.GetSingleTestDatabaseCollection() + resp := btc.rt.SendAdminRequest("PUT", "/db/_user/user", GetUserPayload(t, "user", "test", "", collection, []string{"A", "B"}, nil)) + RequireStatus(t, resp, http.StatusOK) - changes, err := rt.WaitForChanges(1, "/{{.keyspace}}/_changes?since=0&revocations=true", "user", true) + version := btc.rt.PutDoc(docID, `{"channels": ["A", "B"]}`) + + changes, err := btc.rt.WaitForChanges(1, "/{{.keyspace}}/_changes?since=0&revocations=true", "user", true) require.NoError(t, err) assert.Equal(t, 1, len(changes.Results)) assert.Equal(t, "doc", changes.Results[0].ID) @@ -1976,9 +1980,9 @@ func TestRemovedMessageWithAlternateAccess(t *testing.T) { _, ok := btc.WaitForVersion(docID, version) assert.True(t, ok) - version = rt.UpdateDoc(docID, version, `{"channels": ["B"]}`) + version = btc.rt.UpdateDoc(docID, version, `{"channels": ["B"]}`) - changes, err = rt.WaitForChanges(1, fmt.Sprintf("/{{.keyspace}}/_changes?since=%s&revocations=true", changes.Last_Seq), "user", true) + changes, err = btc.rt.WaitForChanges(1, fmt.Sprintf("/{{.keyspace}}/_changes?since=%s&revocations=true", changes.Last_Seq), "user", true) require.NoError(t, err) assert.Equal(t, 1, len(changes.Results)) assert.Equal(t, docID, changes.Results[0].ID) @@ -1989,10 +1993,10 @@ func TestRemovedMessageWithAlternateAccess(t *testing.T) { _, ok = btc.WaitForVersion(docID, version) assert.True(t, ok) - version = rt.UpdateDoc(docID, version, `{"channels": []}`) - docMarkerVersion := rt.PutDoc(docMarker, `{"channels": ["!"]}`) + version = btc.rt.UpdateDoc(docID, version, `{"channels": []}`) + docMarkerVersion := btc.rt.PutDoc(docMarker, `{"channels": ["!"]}`) - changes, err = rt.WaitForChanges(2, fmt.Sprintf("/{{.keyspace}}/_changes?since=%s&revocations=true", changes.Last_Seq), "user", true) + changes, err = btc.rt.WaitForChanges(2, fmt.Sprintf("/{{.keyspace}}/_changes?since=%s&revocations=true", changes.Last_Seq), "user", true) require.NoError(t, err) assert.Len(t, changes.Results, 2) assert.Equal(t, "doc", changes.Results[0].ID) @@ -2074,9 +2078,9 @@ func TestRemovedMessageWithAlternateAccessAndChannelFilteredReplication(t *testi resp := btc.rt.SendAdminRequest("PUT", "/db/_user/user", GetUserPayload(t, "user", "test", "", collection, []string{"A", "B"}, nil)) RequireStatus(t, resp, http.StatusOK) - version := rt.PutDoc(docID, `{"channels": ["A", "B"]}`) + version := btc.rt.PutDoc(docID, `{"channels": ["A", "B"]}`) - changes, err := rt.WaitForChanges(1, "/{{.keyspace}}/_changes?since=0&revocations=true", "user", true) + changes, err := btc.rt.WaitForChanges(1, "/{{.keyspace}}/_changes?since=0&revocations=true", "user", true) require.NoError(t, err) assert.Equal(t, 1, len(changes.Results)) assert.Equal(t, docID, changes.Results[0].ID) @@ -2087,11 +2091,11 @@ func TestRemovedMessageWithAlternateAccessAndChannelFilteredReplication(t *testi _, ok := btc.WaitForVersion(docID, version) assert.True(t, ok) - version = rt.UpdateDoc(docID, version, `{"channels": ["C"]}`) - require.NoError(t, rt.WaitForPendingChanges()) + version = btc.rt.UpdateDoc(docID, version, `{"channels": ["C"]}`) + require.NoError(t, btc.rt.WaitForPendingChanges()) // At this point changes should send revocation, as document isn't in any of the user's channels - changes, err = rt.WaitForChanges(1, "/{{.keyspace}}/_changes?filter=sync_gateway/bychannel&channels=A&since=0&revocations=true", "user", true) + changes, err = btc.rt.WaitForChanges(1, "/{{.keyspace}}/_changes?filter=sync_gateway/bychannel&channels=A&since=0&revocations=true", "user", true) require.NoError(t, err) assert.Equal(t, 1, len(changes.Results)) assert.Equal(t, docID, changes.Results[0].ID) @@ -2102,12 +2106,12 @@ func TestRemovedMessageWithAlternateAccessAndChannelFilteredReplication(t *testi _, ok = btc.WaitForVersion(docID, version) assert.True(t, ok) - _ = rt.UpdateDoc(docID, version, `{"channels": ["B"]}`) - markerVersion := rt.PutDoc(markerID, `{"channels": ["A"]}`) - require.NoError(t, rt.WaitForPendingChanges()) + _ = btc.rt.UpdateDoc(docID, version, `{"channels": ["B"]}`) + markerVersion := btc.rt.PutDoc(markerID, `{"channels": ["A"]}`) + require.NoError(t, btc.rt.WaitForPendingChanges()) // Revocation should not be sent over blip, as document is now in user's channels - only marker document should be received - changes, err = rt.WaitForChanges(1, "/{{.keyspace}}/_changes?filter=sync_gateway/bychannel&channels=A&since=0&revocations=true", "user", true) + changes, err = btc.rt.WaitForChanges(1, "/{{.keyspace}}/_changes?filter=sync_gateway/bychannel&channels=A&since=0&revocations=true", "user", true) require.NoError(t, err) assert.Len(t, changes.Results, 2) // _changes still gets two results, as we don't support 3.0 removal handling over REST API assert.Equal(t, "doc", changes.Results[0].ID) @@ -2394,9 +2398,9 @@ func TestBlipInternalPropertiesHandling(t *testing.T) { require.NoError(t, err) var bucketDoc map[string]interface{} - _, err = rt.GetSingleDataStore().Get(docID, &bucketDoc) + _, err = client.rt.GetSingleDataStore().Get(docID, &bucketDoc) assert.NoError(t, err) - body := rt.GetDocBody(docID) + body := client.rt.GetDocBody(docID) // Confirm input body is in the bucket doc if test.skipDocContentsVerification == nil || !*test.skipDocContentsVerification { for k, v := range test.inputBody { @@ -2565,7 +2569,7 @@ func TestSendRevisionNoRevHandling(t *testing.T) { recievedNoRevs <- msg } - version := rt.PutDoc(docName, `{"foo":"bar"}`) + version := btc.rt.PutDoc(docName, `{"foo":"bar"}`) // Make the LeakyBucket return an error leakyDataStore.SetGetRawCallback(func(key string) error { @@ -2623,7 +2627,7 @@ func TestUnsubChanges(t *testing.T) { // Sub changes err = btc.StartPull() require.NoError(t, err) - doc1Version := rt.PutDoc(doc1ID, `{"key":"val1"}`) + doc1Version := btc.rt.PutDoc(doc1ID, `{"key":"val1"}`) _, found := btc.WaitForVersion(doc1ID, doc1Version) require.True(t, found) @@ -2638,8 +2642,8 @@ func TestUnsubChanges(t *testing.T) { base.RequireWaitForStat(t, activeReplStat.Value, 0) // Confirm no more changes are being sent - doc2Version := rt.PutDoc(doc2ID, `{"key":"val1"}`) - err = rt.WaitForConditionWithOptions(func() bool { + doc2Version := btc.rt.PutDoc(doc2ID, `{"key":"val1"}`) + err = btc.rt.WaitForConditionWithOptions(func() bool { _, found = btc.GetVersion("doc2", doc2Version) return found }, 10, 100) @@ -2796,7 +2800,7 @@ func TestBlipRefreshUser(t *testing.T) { const username = "bernard" // Initialize blip tester client (will create user) - btc := NewBlipTesterClientOptsWithRT(&BlipTesterClientOpts{ + btc := NewBlipTesterClientOptsWithRT(&BlipTesterClientOpts{ // This test will need refactoring when its getting fixed in CBG-3512 Username: "bernard", Channels: []string{"chan1"}, }) diff --git a/rest/blip_api_delta_sync_test.go b/rest/blip_api_delta_sync_test.go index 8e5e6a7060..3c59f501be 100644 --- a/rest/blip_api_delta_sync_test.go +++ b/rest/blip_api_delta_sync_test.go @@ -119,7 +119,7 @@ func TestBlipDeltaSyncPushPullNewAttachment(t *testing.T) { // Create doc1 rev 1-77d9041e49931ceef58a1eef5fd032e8 on SG with an attachment bodyText := `{"greetings":[{"hi": "alice"}],"_attachments":{"hello.txt":{"data":"aGVsbG8gd29ybGQ="}}}` - version := rt.PutDoc(docID, bodyText) + version := btc.rt.PutDoc(docID, bodyText) data, ok := btc.WaitForVersion(docID, version) assert.True(t, ok) @@ -135,7 +135,7 @@ func TestBlipDeltaSyncPushPullNewAttachment(t *testing.T) { _, ok = btc.pushReplication.WaitForMessage(2) assert.True(t, ok) - respBody := rt.GetDocVersion(docID, version) + respBody := btc.rt.GetDocVersion(docID, version) assert.Equal(t, docID, respBody[db.BodyId]) greetings := respBody["greetings"].([]interface{}) @@ -186,15 +186,14 @@ func TestBlipDeltaSyncNewAttachmentPull(t *testing.T) { assert.NoError(t, err) // create doc1 rev 1-0335a345b6ffed05707ccc4cbc1b67f4 - // create doc1 rev 1-0335a345b6ffed05707ccc4cbc1b67f4 - version := rt.PutDoc(doc1ID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) + version := client.rt.PutDoc(doc1ID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) data, ok := client.WaitForVersion(doc1ID, version) assert.True(t, ok) assert.Equal(t, `{"greetings":[{"hello":"world!"},{"hi":"alice"}]}`, string(data)) // create doc1 rev 2-10000d5ec533b29b117e60274b1e3653 on SG with the first attachment - version = rt.UpdateDoc(doc1ID, version, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}], "_attachments": {"hello.txt": {"data":"aGVsbG8gd29ybGQ="}}}`) + version = client.rt.UpdateDoc(doc1ID, version, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}], "_attachments": {"hello.txt": {"data":"aGVsbG8gd29ybGQ="}}}`) data, ok = client.WaitForVersion(doc1ID, version) assert.True(t, ok) @@ -238,7 +237,7 @@ func TestBlipDeltaSyncNewAttachmentPull(t *testing.T) { assert.Contains(t, string(msgBody), `"greetings":[{"hello":"world!"},{"hi":"alice"}]`) } - respBody := rt.GetDocVersion(doc1ID, version) + respBody := client.rt.GetDocVersion(doc1ID, version) assert.Equal(t, doc1ID, respBody[db.BodyId]) greetings := respBody["greetings"].([]interface{}) assert.Len(t, greetings, 2) @@ -286,14 +285,14 @@ func TestBlipDeltaSyncPull(t *testing.T) { assert.NoError(t, err) // create doc1 rev 1-0335a345b6ffed05707ccc4cbc1b67f4 - version := rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) + version := client.rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) data, ok := client.WaitForVersion(docID, version) assert.True(t, ok) assert.Equal(t, `{"greetings":[{"hello":"world!"},{"hi":"alice"}]}`, string(data)) // create doc1 rev 2-959f0e9ad32d84ff652fb91d8d0caa7e - version = rt.UpdateDoc(docID, version, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}, {"howdy": 12345678901234567890}]}`) + version = client.rt.UpdateDoc(docID, version, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}, {"howdy": 12345678901234567890}]}`) data, ok = client.WaitForVersion(docID, version) assert.True(t, ok) @@ -353,7 +352,7 @@ func TestBlipDeltaSyncPullResend(t *testing.T) { client.Run(func(t *testing.T) { // create doc1 rev 1 - docVersion1 := rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) + docVersion1 := client.rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) deltaSentCount := client.rt.GetDatabase().DbStats.DeltaSync().DeltasSent.Value() @@ -361,14 +360,14 @@ func TestBlipDeltaSyncPullResend(t *testing.T) { client.rejectDeltasForSrcRev = docVersion1.RevID client.ClientDeltas = true - err = client.StartPull() + err := client.StartPull() assert.NoError(t, err) data, ok := client.WaitForVersion(docID, docVersion1) assert.True(t, ok) assert.Equal(t, `{"greetings":[{"hello":"world!"},{"hi":"alice"}]}`, string(data)) // create doc1 rev 2 - docVersion2 := rt.UpdateDoc(docID, docVersion1, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}, {"howdy": 12345678901234567890}]}`) + docVersion2 := client.rt.UpdateDoc(docID, docVersion1, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}, {"howdy": 12345678901234567890}]}`) data, ok = client.WaitForVersion(docID, docVersion2) assert.True(t, ok) @@ -383,7 +382,7 @@ func TestBlipDeltaSyncPullResend(t *testing.T) { msgBody, err := msg.Body() assert.NoError(t, err) assert.Equal(t, `{"greetings":{"2-":[{"howdy":12345678901234567890}]}}`, string(msgBody)) - assert.Equal(t, deltaSentCount+1, rt.GetDatabase().DbStats.DeltaSync().DeltasSent.Value()) + assert.Equal(t, deltaSentCount+1, client.rt.GetDatabase().DbStats.DeltaSync().DeltasSent.Value()) msg, ok = client.WaitForBlipRevMessage(docID, docVersion2) assert.True(t, ok) @@ -429,7 +428,7 @@ func TestBlipDeltaSyncPullRemoved(t *testing.T) { assert.NoError(t, err) // create doc1 rev 1-1513b53e2738671e634d9dd111f48de0 - version := rt.PutDoc(docID, `{"channels": ["public"], "greetings": [{"hello": "world!"}]}`) + version := client.rt.PutDoc(docID, `{"channels": ["public"], "greetings": [{"hello": "world!"}]}`) data, ok := client.WaitForVersion(docID, version) assert.True(t, ok) @@ -437,7 +436,7 @@ func TestBlipDeltaSyncPullRemoved(t *testing.T) { assert.Contains(t, string(data), `"greetings":[{"hello":"world!"}]`) // create doc1 rev 2-ff91e11bc1fd12bbb4815a06571859a9 - version = rt.UpdateDoc(docID, version, `{"channels": ["private"], "greetings": [{"hello": "world!"}, {"hi": "bob"}]}`) + version = client.rt.UpdateDoc(docID, version, `{"channels": ["private"], "greetings": [{"hello": "world!"}, {"hi": "bob"}]}`) data, ok = client.WaitForVersion(docID, version) assert.True(t, ok) @@ -500,14 +499,14 @@ func TestBlipDeltaSyncPullTombstoned(t *testing.T) { assert.NoError(t, err) // create doc1 rev 1-e89945d756a1d444fa212bffbbb31941 - version := rt.PutDoc(docID, `{"channels": ["public"], "greetings": [{"hello": "world!"}]}`) + version := client.rt.PutDoc(docID, `{"channels": ["public"], "greetings": [{"hello": "world!"}]}`) data, ok := client.WaitForVersion(docID, version) assert.True(t, ok) assert.Contains(t, string(data), `"channels":["public"]`) assert.Contains(t, string(data), `"greetings":[{"hello":"world!"}]`) // tombstone doc1 at rev 2-2db70833630b396ef98a3ec75b3e90fc - version = rt.DeleteDocReturnVersion(docID, version) + version = client.rt.DeleteDocReturnVersion(docID, version) data, ok = client.WaitForVersion(docID, version) assert.True(t, ok) @@ -600,7 +599,7 @@ func TestBlipDeltaSyncPullTombstonedStarChan(t *testing.T) { require.NoError(t, err) // create doc1 rev 1-e89945d756a1d444fa212bffbbb31941 - version := rt.PutDoc(docID, `{"channels": ["public"], "greetings": [{"hello": "world!"}]}`) + version := client1.rt.PutDoc(docID, `{"channels": ["public"], "greetings": [{"hello": "world!"}]}`) data, ok := client1.WaitForVersion(docID, version) assert.True(t, ok) @@ -616,7 +615,7 @@ func TestBlipDeltaSyncPullTombstonedStarChan(t *testing.T) { assert.Contains(t, string(data), `"greetings":[{"hello":"world!"}]`) // tombstone doc1 at rev 2-2db70833630b396ef98a3ec75b3e90fc - version = rt.DeleteDocReturnVersion(docID, version) + version = client1.rt.DeleteDocReturnVersion(docID, version) data, ok = client1.WaitForVersion(docID, version) assert.True(t, ok) @@ -722,7 +721,7 @@ func TestBlipDeltaSyncPullRevCache(t *testing.T) { assert.NoError(t, err) // create doc1 rev 1-0335a345b6ffed05707ccc4cbc1b67f4 - version1 := rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) + version1 := client.rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) data, ok := client.WaitForVersion(docID, version1) assert.True(t, ok) @@ -737,7 +736,7 @@ func TestBlipDeltaSyncPullRevCache(t *testing.T) { assert.Equal(t, `{"greetings":[{"hello":"world!"},{"hi":"alice"}]}`, string(data)) // create doc1 rev 2-959f0e9ad32d84ff652fb91d8d0caa7e - version2 := rt.UpdateDoc(docID, version1, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}, {"howdy": "bob"}]}`) + version2 := client.rt.UpdateDoc(docID, version1, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}, {"howdy": "bob"}]}`) data, ok = client.WaitForVersion(docID, version2) assert.True(t, ok) @@ -804,7 +803,7 @@ func TestBlipDeltaSyncPush(t *testing.T) { assert.NoError(t, err) // create doc1 rev 1-0335a345b6ffed05707ccc4cbc1b67f4 - version := rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) + version := client.rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) data, ok := client.WaitForVersion(docID, version) assert.True(t, ok) @@ -839,7 +838,7 @@ func TestBlipDeltaSyncPush(t *testing.T) { assert.Equal(t, `{"greetings":[{"hello":"world!"},{"hi":"alice"},{"howdy":"bob"}]}`, string(msgBody)) } - respBody := rt.GetDocVersion(docID, newRev) + respBody := client.rt.GetDocVersion(docID, newRev) assert.Equal(t, "doc1", respBody[db.BodyId]) greetings := respBody["greetings"].([]interface{}) assert.Len(t, greetings, 3) @@ -848,7 +847,7 @@ func TestBlipDeltaSyncPush(t *testing.T) { assert.Equal(t, map[string]interface{}{"howdy": "bob"}, greetings[2]) // tombstone doc1 (gets rev 3-f3be6c85e0362153005dae6f08fc68bb) - deletedVersion := rt.DeleteDocReturnVersion(docID, newRev) + deletedVersion := client.rt.DeleteDocReturnVersion(docID, newRev) data, ok = client.WaitForVersion(docID, deletedVersion) assert.True(t, ok) @@ -907,7 +906,7 @@ func TestBlipNonDeltaSyncPush(t *testing.T) { assert.NoError(t, err) // create doc1 rev 1-0335a345b6ffed05707ccc4cbc1b67f4 - version := rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) + version := client.rt.PutDoc(docID, `{"greetings": [{"hello": "world!"}, {"hi": "alice"}]}`) data, ok := client.WaitForVersion(docID, version) assert.True(t, ok) @@ -927,7 +926,7 @@ func TestBlipNonDeltaSyncPush(t *testing.T) { assert.NotEqual(t, `{"greetings":{"2-":[{"howdy":"bob"}]}}`, string(msgBody)) assert.Equal(t, `{"greetings":[{"hello":"world!"},{"hi":"alice"},{"howdy":"bob"}]}`, string(msgBody)) - body := rt.GetDocVersion("doc1", newRev) + body := client.rt.GetDocVersion("doc1", newRev) require.Equal(t, "bob", body["greetings"].([]interface{})[2].(map[string]interface{})["howdy"]) }, t, rtConfig) } diff --git a/rest/blip_client_test.go b/rest/blip_client_test.go index 0d82fdb198..c69a568983 100644 --- a/rest/blip_client_test.go +++ b/rest/blip_client_test.go @@ -38,7 +38,7 @@ type BlipTesterClientOpts struct { SupportedBLIPProtocols []string SkipCollectionsInitialization bool SkipVersionVectorInitialization bool - NumCollectionsNeeded int + NumCollectionsRequired int // a deltaSrc rev ID for which to reject a delta rejectDeltasForSrcRev string @@ -676,8 +676,8 @@ func (btc *BlipTesterClient) RunWithRevocationTester(test func(t *testing.T, tes } func (btc *BlipTesterClient) Run(test func(*testing.T), t *testing.T, rtConfig *RestTesterConfig) { - if btc.NumCollectionsNeeded != 0 { - btc.rt = NewRestTesterMultipleCollections(t, rtConfig, btc.NumCollectionsNeeded) + if btc.NumCollectionsRequired != 0 { + btc.rt = NewRestTesterMultipleCollections(t, rtConfig, btc.NumCollectionsRequired) } else { // assume standard rest tester creation btc.rt = NewRestTester(t, rtConfig) @@ -700,8 +700,8 @@ func (btc *BlipTesterClient) Run(test func(*testing.T), t *testing.T, rtConfig * btc.rt.Close() // setup rest tester for new run - if btc.NumCollectionsNeeded != 0 { - btc.rt = NewRestTesterMultipleCollections(t, rtConfig, btc.NumCollectionsNeeded) + if btc.NumCollectionsRequired != 0 { + btc.rt = NewRestTesterMultipleCollections(t, rtConfig, btc.NumCollectionsRequired) } else { // assume standard rest tester creation btc.rt = NewRestTester(t, rtConfig) diff --git a/rest/revocation_test.go b/rest/revocation_test.go index 9bfb679011..43b9f97eee 100644 --- a/rest/revocation_test.go +++ b/rest/revocation_test.go @@ -2239,7 +2239,7 @@ func TestRevocationMessage(t *testing.T) { // Skip to seq 4 and then create doc in channel A revocationTester.fillToSeq(4) - version := rt.PutDoc("doc", `{"channels": "A"}`) + version := btc.rt.PutDoc("doc", `{"channels": "A"}`) require.NoError(t, btc.rt.WaitForPendingChanges()) @@ -2254,10 +2254,10 @@ func TestRevocationMessage(t *testing.T) { // Remove role from user revocationTester.removeRole("user", "foo") - version = rt.PutDoc(doc1ID, `{"channels": "!"}`) + version = btc.rt.PutDoc(doc1ID, `{"channels": "!"}`) revocationTester.fillToSeq(10) - version = rt.UpdateDoc(doc1ID, version, "{}") + version = btc.rt.UpdateDoc(doc1ID, version, "{}") require.NoError(t, btc.rt.WaitForPendingChanges()) @@ -2348,7 +2348,7 @@ func TestRevocationNoRev(t *testing.T) { // Skip to seq 4 and then create doc in channel A revocationTester.fillToSeq(4) - version := rt.PutDoc(docID, `{"channels": "A"}`) + version := btc.rt.PutDoc(docID, `{"channels": "A"}`) require.NoError(t, btc.rt.WaitForPendingChanges()) firstOneShotSinceSeq := btc.rt.GetDocumentSequence("doc") @@ -2363,10 +2363,10 @@ func TestRevocationNoRev(t *testing.T) { // Remove role from user revocationTester.removeRole("user", "foo") - _ = rt.UpdateDoc(docID, version, `{"channels": "A", "val": "mutate"}`) + _ = btc.rt.UpdateDoc(docID, version, `{"channels": "A", "val": "mutate"}`) - waitMarkerVersion := rt.PutDoc(waitMarkerID, `{"channels": "!"}`) - require.NoError(t, rt.WaitForPendingChanges()) + waitMarkerVersion := btc.rt.PutDoc(waitMarkerID, `{"channels": "!"}`) + require.NoError(t, btc.rt.WaitForPendingChanges()) lastSeqStr := strconv.FormatUint(firstOneShotSinceSeq, 10) err = btc.StartPullSince("false", lastSeqStr, "false") @@ -2433,20 +2433,20 @@ func TestRevocationGetSyncDataError(t *testing.T) { const waitMarkerID = "docmarker" btc.RunWithRevocationTester(func(t *testing.T, revocationTester ChannelRevocationTester) { - revocationTester.fillerDocRev = "" + revocationTester.fillerDocVersion.RevID = "" // Add channel to role and role to user revocationTester.addRoleChannel("foo", "A") revocationTester.addRole("user", "foo") // Skip to seq 4 and then create doc in channel A revocationTester.fillToSeq(4) - version := rt.PutDoc(docID, `{"channels": "A"}}`) + version := btc.rt.PutDoc(docID, `{"channels": "A"}}`) require.NoError(t, btc.rt.WaitForPendingChanges()) firstOneShotSinceSeq := btc.rt.GetDocumentSequence("doc") // OneShot pull to grab doc - err = btc.StartOneshotPull() + err := btc.StartOneshotPull() assert.NoError(t, err) throw = true _, ok := btc.WaitForVersion(docID, version) @@ -2455,10 +2455,10 @@ func TestRevocationGetSyncDataError(t *testing.T) { // Remove role from user revocationTester.removeRole("user", "foo") - _ = rt.UpdateDoc(docID, version, `{"channels": "A", "val": "mutate"}`) + _ = btc.rt.UpdateDoc(docID, version, `{"channels": "A", "val": "mutate"}`) - waitMarkerVersion := rt.PutDoc(waitMarkerID, `{"channels": "!"}`) - require.NoError(t, rt.WaitForPendingChanges()) + waitMarkerVersion := btc.rt.PutDoc(waitMarkerID, `{"channels": "!"}`) + require.NoError(t, btc.rt.WaitForPendingChanges()) lastSeqStr := strconv.FormatUint(firstOneShotSinceSeq, 10) err = btc.StartPullSince("false", lastSeqStr, "false")