summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatherine Wu <katherine.wu@mongodb.com>2021-05-24 16:58:48 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-17 15:40:31 +0000
commit41ddb7524a860cce66131901094ee6d4685a3dc3 (patch)
treeaa7d877af0bcc744726e9a86d64861961a669f62
parent6e32e86f4f6340a0697706b9db7fb1d83d03b3c3 (diff)
downloadmongo-41ddb7524a860cce66131901094ee6d4685a3dc3.tar.gz
SERVER-57165 Ensure currentOp_shell.js tests target the correct operation
(cherry picked from commit 124fdbe60bcda1590832a72687af8204f2673183)
-rw-r--r--jstests/core/currentop_shell.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/jstests/core/currentop_shell.js b/jstests/core/currentop_shell.js
index 62d36f38c6d..6eba95ddc73 100644
--- a/jstests/core/currentop_shell.js
+++ b/jstests/core/currentop_shell.js
@@ -57,28 +57,31 @@ function shellOp() {
aggregate: "currentOp_cursor",
pipeline: [{
$addFields: {
- newVal: {$function: {args: [], body: "sleep(300000)", lang: "js"}},
+ newVal: {$function: {args: [], body: "sleep(1000000)", lang: "js"}},
bigDoc: createLargeDoc()
}
}],
+ comment: TestData.comment,
cursor: {}
}),
ErrorCodes.Interrupted);
}
-function startShellWithOp() {
+function startShellWithOp(comment) {
+ TestData.comment = comment;
const awaitShell = startParallelShell(shellOp);
// Confirm that the operation has started in the parallel shell.
assert.soon(
function() {
- let aggRes = db.getSiblingDB("admin")
- .aggregate([
- {$currentOp: {allUsers: true, localOps: true}},
- {$match: {ns: "test.currentOp_cursor"}}
- ])
- .toArray();
- return aggRes.length === 1;
+ let aggRes =
+ db.getSiblingDB("admin")
+ .aggregate([
+ {$currentOp: {}},
+ {$match: {ns: "test.currentOp_cursor", "command.comment": TestData.comment}}
+ ])
+ .toArray();
+ return aggRes.length >= 1;
},
function() {
return "Failed to find parallel shell operation in $currentOp output: " +
@@ -88,8 +91,8 @@ function startShellWithOp() {
}
// Test that the currentOp server command truncates long operations with a warning logged.
-const serverCommandTest = startShellWithOp();
-res = db.adminCommand({currentOp: true, "ns": "test.currentOp_cursor", $all: true});
+const serverCommandTest = startShellWithOp("currentOp_server");
+res = db.adminCommand({currentOp: true, "ns": "test.currentOp_cursor"});
if (FixtureHelpers.isMongos(db) && FixtureHelpers.isSharded(coll)) {
// Assert currentOp truncation behavior for each shard in the cluster.
@@ -115,7 +118,7 @@ res.inprog.forEach((op) => {
serverCommandTest();
// Test that the db.currentOp() shell helper does not truncate ops.
-const shellHelperTest = startShellWithOp();
+const shellHelperTest = startShellWithOp("currentOp_shell");
res = db.currentOp({"ns": "test.currentOp_cursor"});
if (FixtureHelpers.isMongos(db) && FixtureHelpers.isSharded(coll)) {