From 137aafec49ca45b6bf04f1cd17b78b45353b5bd8 Mon Sep 17 00:00:00 2001 From: "Mickey. J Winters" Date: Wed, 10 May 2023 14:08:25 +0000 Subject: SERVER-76930 robustify awaitdata_getmore_cmd.js --- jstests/core/query/awaitdata_getmore_cmd.js | 14 ++++++++++---- 1 file 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); } } -- cgit v1.2.1