Files
mongo/jstests/libs/wait_for_command.js
Daniel Tabacaru 8a5d475448 SERVER-99927 Replace print*() with jsTest.log.*() in jstests/libs (#32243)
GitOrigin-RevId: d9eb298e1837085b0a4e6bfee676de54835c56d4
2025-04-09 21:02:58 +00:00

16 lines
467 B
JavaScript

export const waitForCommand = function(waitingFor, opFilter, myDB) {
let opId = -1;
assert.soon(function() {
jsTest.log.info(`Checking for ${waitingFor}`);
const curopRes = myDB.currentOp();
assert.commandWorked(curopRes);
const foundOp = curopRes["inprog"].filter(opFilter);
if (foundOp.length == 1) {
opId = foundOp[0]["opid"];
}
return (foundOp.length == 1);
});
return opId;
};