summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Pe <erwin.pe@mongodb.com>2021-10-05 14:40:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-05 16:39:37 +0000
commitdf815b97b49dd4385299447a880df6f6a66bffb0 (patch)
tree448e7b35c59024052959af92e94e3b5d83600727
parentc5b030f1235b9a8340c0a30181c6104500f15eb3 (diff)
downloadmongo-df815b97b49dd4385299447a880df6f6a66bffb0.tar.gz
SERVER-60363 Make assertion for amount of retries in ocsp_retry_backo…
-rw-r--r--jstests/ocsp/ocsp_retry_backoff.js7
-rw-r--r--src/mongo/shell/check_log.js13
2 files changed, 17 insertions, 3 deletions
diff --git a/jstests/ocsp/ocsp_retry_backoff.js b/jstests/ocsp/ocsp_retry_backoff.js
index 1be4def897d..ec23b4b13a5 100644
--- a/jstests/ocsp/ocsp_retry_backoff.js
+++ b/jstests/ocsp/ocsp_retry_backoff.js
@@ -31,11 +31,12 @@ let conn = MongoRunner.runMongod(ocsp_options);
sleep(10000);
-// validate that fetchAndStaple was invoked 5 times
+// validate that fetchAndStaple was invoked at least 5 times in the 10+ seconds
+// since the mongod process started.
const FETCH_LOG_ID = 577164;
assert.eq(true,
- checkLog.checkContainsWithCountJson(conn, FETCH_LOG_ID, {}, 5),
- 'Number of log lines with ID ' + FETCH_LOG_ID + ' does not match expected');
+ checkLog.checkContainsWithAtLeastCountJson(conn, FETCH_LOG_ID, {}, 5),
+ 'Number of log lines with ID ' + FETCH_LOG_ID + ' is less than expected');
MongoRunner.stopMongod(conn);
diff --git a/src/mongo/shell/check_log.js b/src/mongo/shell/check_log.js
index fe2712e9d9d..fc74d871cc1 100644
--- a/src/mongo/shell/check_log.js
+++ b/src/mongo/shell/check_log.js
@@ -121,6 +121,18 @@ checkLog = (function() {
};
/*
+ * Similar to checkContainsWithCountJson, but checks whether there are at least 'expectedCount'
+ * instances of 'id' in the logs.
+ */
+ const checkContainsWithAtLeastCountJson = function(
+ conn, id, attrsDict, expectedCount, severity = null, isRelaxed = false, context = null) {
+ return checkContainsWithCountJson(
+ conn, id, attrsDict, expectedCount, severity, isRelaxed, (actual, expected) => {
+ return actual >= expected;
+ }, context);
+ };
+
+ /*
* Calls the 'getLog' function on the provided connection 'conn' to see if a log with the
* provided id is found in the logs. If the id is found it looks up the specified attrribute by
* attrName and checks if the msg is found in its value. Note: this function does not throw an
@@ -401,6 +413,7 @@ checkLog = (function() {
checkContainsOnce: checkContainsOnce,
checkContainsOnceJson: checkContainsOnceJson,
checkContainsWithCountJson: checkContainsWithCountJson,
+ checkContainsWithAtLeastCountJson: checkContainsWithAtLeastCountJson,
checkContainsOnceJsonStringMatch: checkContainsOnceJsonStringMatch,
contains: contains,
containsJson: containsJson,