Skip to content

Commit 1b42fc2

Browse files
committed
Fix misused require.FailNow where failureMessage was absent
1 parent 3568d2f commit 1b42fc2

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

rest/utilities_testing_blip_client.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (c *BlipTesterCollectionClient) OneShotDocsSince(ctx context.Context, since
136136
continue
137137
} else if latestDocSeq := doc.latestSeq(); latestDocSeq != seq {
138138
// this entry should've been cleaned up from _seqStore
139-
require.FailNow(c.TB(), "seq %d found in _seqStore but latestSeq for doc %d - this should've been pruned out!", seq, latestDocSeq)
139+
require.FailNowf(c.TB(), "found old seq in _seqStore", "seq %d found in _seqStore but latestSeq for doc %d - this should've been pruned out!", seq, latestDocSeq)
140140
continue
141141
}
142142
if !yield(seq, doc) {
@@ -384,7 +384,7 @@ func (btcc *BlipTesterCollectionClient) _getClientDoc(docID string) (*clientDoc,
384384
}
385385
clientDoc, ok := btcc._seqStore[seq]
386386
if !ok {
387-
require.FailNow(btcc.TB(), "docID %q found in _seqFromDocID but seq %d not in _seqStore %v", docID, seq, btcc._seqStore)
387+
require.FailNowf(btcc.TB(), "seq not found in _seqStore", "docID %q found in _seqFromDocID but seq %d not in _seqStore %v", docID, seq, btcc._seqStore)
388388
return nil, false
389389
}
390390
return clientDoc, ok
@@ -612,7 +612,7 @@ func (btr *BlipTesterReplicator) initHandlers(btc *BlipTesterClient) {
612612

613613
// safety check - ensure SG is not sending a rev that we already had - ensures changes feed messaging is working correctly to prevent
614614
if clientCV.SourceID == incomingCV.SourceID && clientCV.Value == incomingCV.Value {
615-
require.FailNow(btc.TB(), "incoming revision %v is equal to client revision %v - should've been filtered via changes response before ending up as a rev", incomingCV, clientCV)
615+
require.FailNowf(btc.TB(), "incoming revision is equal to client revision", "incoming revision %v is equal to client revision %v - should've been filtered via changes response before ending up as a rev", incomingCV, clientCV)
616616
}
617617

618618
// incoming rev older than stored client version and comes from a different source - need to resolve
@@ -696,7 +696,7 @@ func (btr *BlipTesterReplicator) initHandlers(btc *BlipTesterClient) {
696696
response.SetError("HTTP", http.StatusUnprocessableEntity, "test code intentionally rejected delta")
697697
return
698698
}
699-
require.FailNow(btr.TB(), "expected delta rev message to be sent without noreply flag: %+v", msg)
699+
require.FailNowf(btr.TB(), "expected delta rev message to be sent without noreply flag", "msg: %+v", msg)
700700
}
701701

702702
// unmarshal body to extract deltaSrc
@@ -707,7 +707,7 @@ func (btr *BlipTesterReplicator) initHandlers(btc *BlipTesterClient) {
707707
var old db.Body
708708
doc, ok := btcr.getClientDoc(docID)
709709
if !ok {
710-
require.FailNow(btc.TB(), "docID %q not found in _seqFromDocID", docID)
710+
require.FailNowf(btc.TB(), "doc not found", "docID %q not found", docID)
711711
return
712712
}
713713
var deltaSrcVersion DocVersion
@@ -877,7 +877,7 @@ func (btr *BlipTesterReplicator) initHandlers(btc *BlipTesterClient) {
877877

878878
// safety check - ensure SG is not sending a rev that we already had - ensures changes feed messaging is working correctly to prevent
879879
if clientCV.SourceID == incomingCV.SourceID && clientCV.Value == incomingCV.Value {
880-
require.FailNow(btc.TB(), "incoming revision %v is equal to client revision %v - should've been filtered via changes response before ending up as a rev", incomingCV, clientCV)
880+
require.FailNowf(btc.TB(), "incoming revision is equal to client revision", "incoming revision %v is equal to client revision %v - should've been filtered via changes response before ending up as a rev", incomingCV, clientCV)
881881
}
882882

883883
// incoming rev older than stored client version and comes from a different source - need to resolve
@@ -1045,7 +1045,7 @@ func (btc *BlipTesterCollectionClient) updateLastReplicatedVersion(docID string,
10451045
defer btc.seqLock.Unlock()
10461046
doc, ok := btc._getClientDoc(docID)
10471047
if !ok {
1048-
require.FailNow(btc.TB(), "docID %q not found in _seqFromDocID", docID)
1048+
require.FailNowf(btc.TB(), "doc not found", "docID %q", docID)
10491049
return
10501050
}
10511051
doc.setLatestServerVersion(version)
@@ -1056,7 +1056,7 @@ func (btc *BlipTesterCollectionClient) getLastReplicatedVersion(docID string) (v
10561056
defer btc.seqLock.Unlock()
10571057
doc, ok := btc._getClientDoc(docID)
10581058
if !ok {
1059-
require.FailNow(btc.TB(), "docID %q not found in _seqFromDocID", docID)
1059+
require.FailNowf(btc.TB(), "doc not found", "docID %q", docID)
10601060
return DocVersion{}, false
10611061
}
10621062
doc.lock.RLock()
@@ -1113,7 +1113,7 @@ func (btcRunner *BlipTestClientRunner) NewBlipTesterClientOptsWithRT(rt *RestTes
11131113
opts.ConflictResolver = ConflictResolverDefault
11141114
}
11151115
if !opts.ConflictResolver.IsValid() {
1116-
require.FailNow(btcRunner.TB(), "invalid conflict resolver %q", opts.ConflictResolver)
1116+
require.FailNowf(btcRunner.TB(), "invalid conflict resolver", "invalid conflict resolver %q", opts.ConflictResolver)
11171117
}
11181118
if opts.SourceID == "" {
11191119
opts.SourceID = "blipclient"
@@ -1258,7 +1258,7 @@ func (btcRunner *BlipTestClientRunner) Collection(clientID uint32, collectionNam
12581258
return collectionClient
12591259
}
12601260
}
1261-
require.FailNow(btcRunner.clients[clientID].TB(), "Could not find collection %s in BlipTesterClient", collectionName)
1261+
require.FailNowf(btcRunner.clients[clientID].TB(), "unknown collection", "Could not find collection %s in BlipTesterClient", collectionName)
12621262
return nil
12631263
}
12641264

@@ -1573,7 +1573,7 @@ func (btc *BlipTesterCollectionClient) StartPullSince(options BlipTesterPullOpti
15731573
errorDomain := subChangesResponse.Properties["Error-Domain"]
15741574
errorCode := subChangesResponse.Properties["Error-Code"]
15751575
if errorDomain != "" && errorCode != "" {
1576-
require.FailNowf(btc.TB(), "error %s %s from subChanges with body: %s", errorDomain, errorCode, string(rspBody))
1576+
require.FailNowf(btc.TB(), "error from subchanges", "error %s %s from subChanges with body: %s", errorDomain, errorCode, string(rspBody))
15771577
}
15781578
}
15791579

@@ -1856,7 +1856,7 @@ func (btc *BlipTesterCollectionClient) ProcessInlineAttachments(inputBody []byte
18561856
// push the stub as-is
18571857
continue
18581858
}
1859-
require.FailNow(btc.TB(), "couldn't find data or stub property for inline attachment %s:%v", attachmentName, inlineAttachment)
1859+
require.FailNowf(btc.TB(), "couldn't find data or stub property for inline attachment", "att name %s:%v", attachmentName, inlineAttachment)
18601860
}
18611861

18621862
// Transform inline attachment data into metadata
@@ -1899,7 +1899,7 @@ func (btc *BlipTesterCollectionClient) GetVersion(docID string, docVersion DocVe
18991899

19001900
rev, ok := doc._revisionsBySeq[revSeq]
19011901
if !ok {
1902-
require.FailNow(btc.TB(), "seq %q for docID %q found but no rev in _seqStore", revSeq, docID)
1902+
require.FailNowf(btc.TB(), "no rev seq in _seqStore", "seq %q for docID %q found but no rev in _seqStore", revSeq, docID)
19031903
return nil, false
19041904
}
19051905

0 commit comments

Comments
 (0)