diff options
-rw-r--r-- | jstests/ocsp/ocsp_retry_backoff.js | 7 | ||||
-rw-r--r-- | src/mongo/shell/check_log.js | 13 |
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, |