Skip to content

Commit bbe66bb

Browse files
committed
Delay PrintGlobalDocState evaluation until failed EventuallyWithT
1 parent d08b9e4 commit bbe66bb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

topologytest/hlv_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func waitForTombstoneVersion(t *testing.T, dsName base.ScopeAndCollectionName, p
7171
// waitForConvergingVersion waits for the same document version to reach all peers.
7272
func waitForConvergingVersion(t *testing.T, dsName base.ScopeAndCollectionName, peers Peers, docID string) {
7373
t.Logf("waiting for converged doc versions across all peers")
74-
require.EventuallyWithTf(t, func(c *assert.CollectT) {
74+
if !assert.EventuallyWithT(t, func(c *assert.CollectT) {
7575
for peerAid, peerA := range peers.SortedPeers() {
7676
docMetaA, bodyA := peerA.GetDocument(dsName, docID)
7777
for peerBid, peerB := range peers.SortedPeers() {
@@ -84,7 +84,10 @@ func waitForConvergingVersion(t *testing.T, dsName base.ScopeAndCollectionName,
8484
require.Equalf(c, bodyA, bodyB, "body mismatch: %s:%s != %s:%s", peerAid, bodyA, peerBid, bodyB)
8585
}
8686
}
87-
}, totalWaitTime, pollInterval, "Peers did not converge on version for doc %q\nGlobal state for all peers:\n%s", docID, peers.PrintGlobalDocState(t, dsName, docID))
87+
}, totalWaitTime, pollInterval) {
88+
// do if !assert->require pattern so we can delay PrintGlobalDocState evaluation
89+
require.FailNowf(t, "Peers did not converge on version", "Global state for doc %q on all peers:\n%s", docID, peers.PrintGlobalDocState(t, dsName, docID))
90+
}
8891
}
8992

9093
// PrintGlobalDocState returns the current state of a document across all peers, and also logs it on `t`.

0 commit comments

Comments
 (0)