Skip to content

Commit 6155d5c

Browse files
authored
CBG-4862 force BlipTester SendRev to check for errors (#7762)
1 parent 076e145 commit 6155d5c

12 files changed

+224
-467
lines changed

rest/access_test.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -806,15 +806,11 @@ func TestChannelAccessChanges(t *testing.T) {
806806
assert.Equal(t, "g1", changes.Results[0].ID)
807807

808808
// Look up sequences for created docs
809-
deltaGrantDocSeq, err := rt.SequenceForDoc("delta")
810-
assert.NoError(t, err, "Error retrieving document sequence")
811-
gammaGrantDocSeq, err := rt.SequenceForDoc("gamma")
812-
assert.NoError(t, err, "Error retrieving document sequence")
809+
deltaGrantDocSeq := rt.SequenceForDoc("delta")
810+
gammaGrantDocSeq := rt.SequenceForDoc("gamma")
813811

814-
alphaDocSeq, err := rt.SequenceForDoc("a1")
815-
assert.NoError(t, err, "Error retrieving document sequence")
816-
gammaDocSeq, err := rt.SequenceForDoc("g1")
817-
assert.NoError(t, err, "Error retrieving document sequence")
812+
alphaDocSeq := rt.SequenceForDoc("a1")
813+
gammaDocSeq := rt.SequenceForDoc("g1")
818814

819815
// Check user access:
820816
alice, _ = a.GetUser("alice")
@@ -843,8 +839,7 @@ func TestChannelAccessChanges(t *testing.T) {
843839
response = rt.SendRequest(http.MethodPut, "/{{.keyspace}}/alpha", str)
844840
RequireStatus(t, response, http.StatusCreated)
845841

846-
alphaGrantDocSeq, err := rt.SequenceForDoc("alpha")
847-
assert.NoError(t, err, "Error retrieving document sequence")
842+
alphaGrantDocSeq := rt.SequenceForDoc("alpha")
848843

849844
// Check user access again:
850845
alice, _ = a.GetUser("alice")

rest/adminapitest/admin_api_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ func TestDBOfflineConcurrent(t *testing.T) {
457457
wg.Done()
458458
}()
459459

460-
err := rest.WaitWithTimeout(&wg, time.Second*30)
461-
assert.NoError(t, err, "Error waiting for waitgroup")
460+
rest.WaitWithTimeout(t, &wg, time.Second*30)
462461
rest.RequireStatus(t, goroutineresponse1, http.StatusOK)
463462
rest.RequireStatus(t, goroutineresponse2, http.StatusOK)
464463

rest/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2052,7 +2052,7 @@ func TestWebhookProperties(t *testing.T) {
20522052
assert.NoError(t, err)
20532053
}
20542054

2055-
require.NoError(t, WaitWithTimeout(&wg, 30*time.Second))
2055+
WaitWithTimeout(t, &wg, 30*time.Second)
20562056
}
20572057

20582058
func TestWebhookSpecialProperties(t *testing.T) {

rest/attachment_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,9 +2483,7 @@ func TestProveAttachmentNotFound(t *testing.T) {
24832483
}
24842484

24852485
// Initial set up
2486-
sent, _, _, err := bt.SendRev("doc1", "1-abc", []byte(`{"key": "val", "_attachments": {"attachment": {"data": "`+attachmentDataEncoded+`"}}}`), blip.Properties{})
2487-
require.True(t, sent)
2488-
require.NoError(t, err)
2486+
bt.SendRev("doc1", "1-abc", []byte(`{"key": "val", "_attachments": {"attachment": {"data": "`+attachmentDataEncoded+`"}}}`), blip.Properties{})
24892487

24902488
rt.WaitForPendingChanges()
24912489

@@ -2495,9 +2493,7 @@ func TestProveAttachmentNotFound(t *testing.T) {
24952493

24962494
// Use different attachment name to bypass digest check in ForEachStubAttachment() which skips prove attachment code
24972495
// Set attachment to V2 so it can be retrieved by RT successfully
2498-
sent, _, _, err = bt.SendRev("doc1", "2-abc", []byte(`{"key": "val", "_attachments":{"attach":{"digest":"sha1-wzp8ZyykdEuZ9GuqmxQ7XDrY7Co=","length":11,"stub":true,"revpos":1,"ver":2}}}`), blip.Properties{})
2499-
require.True(t, sent)
2500-
require.NoError(t, err)
2496+
bt.SendRev("doc1", "2-abc", []byte(`{"key": "val", "_attachments":{"attach":{"digest":"sha1-wzp8ZyykdEuZ9GuqmxQ7XDrY7Co=","length":11,"stub":true,"revpos":1,"ver":2}}}`), blip.Properties{})
25012497

25022498
rt.WaitForPendingChanges()
25032499
// Check attachment is on the document
@@ -2569,8 +2565,7 @@ func TestPutInvalidAttachment(t *testing.T) {
25692565
attachmentBody: test.invalidAttachmentBody,
25702566
attachmentDigest: digest,
25712567
}
2572-
sent, _, resp := bt.SendRevWithAttachment(input)
2573-
assert.True(t, sent)
2568+
resp := bt.SendRevWithAttachment(input)
25742569

25752570
// Make sure we get the expected response back
25762571
assert.Equal(t, test.expectedType, resp.Type())

rest/blip_api_attachment_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ func TestPutAttachmentViaBlipGetViaBlip(t *testing.T) {
472472
attachmentBody: attachmentBody,
473473
attachmentDigest: digest,
474474
}
475-
sent, _, _ := bt.SendRevWithAttachment(input)
476-
assert.True(t, sent)
475+
resp := bt.SendRevWithAttachment(input)
476+
require.NotContains(t, resp.Properties, "Error-Code")
477477

478478
// Get all docs and attachment via subChanges request
479479
allDocs := bt.WaitForNumDocsViaChanges(1)

0 commit comments

Comments
 (0)