summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthrough/mirror_reads.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/jstests/noPassthrough/mirror_reads.js b/jstests/noPassthrough/mirror_reads.js
index 4a27724aeef..9122e6678b4 100644
--- a/jstests/noPassthrough/mirror_reads.js
+++ b/jstests/noPassthrough/mirror_reads.js
@@ -77,18 +77,19 @@ function sendAndCheckReads({rst, cmd, minRate, maxRate, burstCount}) {
return ((readsPending == 0) && (readsSent === readsResolved));
}, "Did not resolve all requests within time limit", 10000);
- // The number of mirrored reads processed across all secondaries.
- let readsProcessedAsSecondaryTotal = 0;
- for (let i = 0; i < secondaries.length; i++) {
- const currentSecondaryMirroredReadsStats = getMirroredReadsStats(secondaries[i]);
- const processedAsSecondary = currentSecondaryMirroredReadsStats.processedAsSecondary -
- initialProcessedAsSecondary[i];
- jsTestLog("Verifying number of reads processed by secondary " + secondaries[i] + ": " +
- tojson({processedAsSecondary: processedAsSecondary}));
- readsProcessedAsSecondaryTotal += processedAsSecondary;
- }
- assert.eq(readsProcessedAsSecondaryTotal, readsSucceeded);
- assert.eq(readsProcessedAsSecondaryTotal, readsSent);
+ assert.soon(() => {
+ // The number of mirrored reads processed across all secondaries.
+ let readsProcessedAsSecondaryTotal = 0;
+ for (let i = 0; i < secondaries.length; i++) {
+ const currentSecondaryMirroredReadsStats = getMirroredReadsStats(secondaries[i]);
+ const processedAsSecondary = currentSecondaryMirroredReadsStats.processedAsSecondary -
+ initialProcessedAsSecondary[i];
+ jsTestLog("Verifying number of reads processed by secondary " + secondaries[i] + ": " +
+ tojson({processedAsSecondary: processedAsSecondary}));
+ readsProcessedAsSecondaryTotal += processedAsSecondary;
+ }
+ return readsProcessedAsSecondaryTotal == readsSucceeded && readsSucceeded == readsSent;
+ }, "Read metrics across secondaries did not converge to expected results", 10000);
jsTestLog("Verifying primary statistics: " +
tojson({current: currentPrimaryMirroredReadsStats, start: initialPrimaryStats}));