diff options
author | Mickey. J Winters <mickey.winters@mongodb.com> | 2023-05-10 14:08:25 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-10 16:09:48 +0000 |
commit | 137aafec49ca45b6bf04f1cd17b78b45353b5bd8 (patch) | |
tree | 5762f7339b316ca4eb277776bea3028cccc5d095 | |
parent | 58e1a84bc927d59affa6a48188c09fd16f591ce3 (diff) | |
download | mongo-137aafec49ca45b6bf04f1cd17b78b45353b5bd8.tar.gz |
SERVER-76930 robustify awaitdata_getmore_cmd.js
-rw-r--r-- | jstests/core/query/awaitdata_getmore_cmd.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/jstests/core/query/awaitdata_getmore_cmd.js b/jstests/core/query/awaitdata_getmore_cmd.js index f657a0ebcfc..5e3b7e4655a 100644 --- a/jstests/core/query/awaitdata_getmore_cmd.js +++ b/jstests/core/query/awaitdata_getmore_cmd.js @@ -145,8 +145,13 @@ if (FixtureHelpers.isReplSet(db)) { jsTestLog('Check that tailing the oplog with awaitData eventually ends up returning ' + 'an empty batch after hitting the timeout.'); - cmdRes = localDB.runCommand( - {find: oplogColl.getName(), batchSize: 2, awaitData: true, tailable: true}); + cmdRes = localDB.runCommand({ + find: oplogColl.getName(), + batchSize: 2, + awaitData: true, + tailable: true, + filter: {ns: {$ne: "config.system.sessions"}} + }); assert.commandWorked(cmdRes); jsTestLog('Oplog tailing result: ' + tojson(cmdRes)); if (cmdRes.cursor.id > NumberLong(0)) { @@ -162,7 +167,7 @@ if (FixtureHelpers.isReplSet(db)) { jsTestLog('Keep issuing getMore on the oplog until we get an empty batch after the ' + 'timeout expires.'); - while (cmdRes.cursor.nextBatch.length > 0) { + assert.soon(() => { now = new Date(); cmdRes = localDB.runCommand( {getMore: cmdRes.cursor.id, collection: oplogColl.getName(), maxTimeMS: 4000}); @@ -170,7 +175,8 @@ if (FixtureHelpers.isReplSet(db)) { jsTestLog('oplog tailing cursor getMore: ' + now + ': ' + tojson(cmdRes)); assert.gt(cmdRes.cursor.id, NumberLong(0)); assert.eq(cmdRes.cursor.ns, oplogColl.getFullName()); - } + return cmdRes.cursor.nextBatch.length == 0; + }); assert.gte((new Date()) - now, 2000); } } |