summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/tailable_getmore_does_not_timeout.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:20:35 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-27 11:02:23 -0400
commit134a4083953270e8a11430395357fb70a29047ad (patch)
treedd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/noPassthroughWithMongod/tailable_getmore_does_not_timeout.js
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/noPassthroughWithMongod/tailable_getmore_does_not_timeout.js')
-rw-r--r--jstests/noPassthroughWithMongod/tailable_getmore_does_not_timeout.js67
1 files changed, 33 insertions, 34 deletions
diff --git a/jstests/noPassthroughWithMongod/tailable_getmore_does_not_timeout.js b/jstests/noPassthroughWithMongod/tailable_getmore_does_not_timeout.js
index 591c5fffd95..600d8be4733 100644
--- a/jstests/noPassthroughWithMongod/tailable_getmore_does_not_timeout.js
+++ b/jstests/noPassthroughWithMongod/tailable_getmore_does_not_timeout.js
@@ -3,34 +3,34 @@
// This test was designed to reproduce SERVER-33942 against a mongod.
// @tags: [requires_capped]
(function() {
- "use strict";
+"use strict";
- // This test runs a getMore in a parallel shell, which will not inherit the implicit session of
- // the cursor establishing command.
- TestData.disableImplicitSessions = true;
+// This test runs a getMore in a parallel shell, which will not inherit the implicit session of
+// the cursor establishing command.
+TestData.disableImplicitSessions = true;
- const coll = db.tailable_getmore_no_timeout;
- coll.drop();
+const coll = db.tailable_getmore_no_timeout;
+coll.drop();
- assert.commandWorked(db.runCommand({create: coll.getName(), capped: true, size: 1024}));
+assert.commandWorked(db.runCommand({create: coll.getName(), capped: true, size: 1024}));
- for (let i = 0; i < 10; ++i) {
- assert.writeOK(coll.insert({_id: i}));
- }
+for (let i = 0; i < 10; ++i) {
+ assert.writeOK(coll.insert({_id: i}));
+}
- const findResponse = assert.commandWorked(
- db.runCommand({find: coll.getName(), filter: {}, tailable: true, awaitData: true}));
- const cursorId = findResponse.cursor.id;
- assert.neq(0, cursorId);
+const findResponse = assert.commandWorked(
+ db.runCommand({find: coll.getName(), filter: {}, tailable: true, awaitData: true}));
+const cursorId = findResponse.cursor.id;
+assert.neq(0, cursorId);
- // Start an operation in a parallel shell that holds the lock for a while.
- const awaitSleepShell = startParallelShell(
- () => assert.commandFailedWithCode(db.adminCommand({sleep: 1, lock: "w", secs: 600}),
- ErrorCodes.Interrupted));
+// Start an operation in a parallel shell that holds the lock for a while.
+const awaitSleepShell = startParallelShell(
+ () => assert.commandFailedWithCode(db.adminCommand({sleep: 1, lock: "w", secs: 600}),
+ ErrorCodes.Interrupted));
- // Start a getMore and verify that it is waiting for the lock.
- const getMoreMaxTimeMS = 10;
- const awaitGetMoreShell = startParallelShell(`
+// Start a getMore and verify that it is waiting for the lock.
+const getMoreMaxTimeMS = 10;
+const awaitGetMoreShell = startParallelShell(`
// Wait for the sleep command to take the lock.
assert.soon(() => db.getSiblingDB("admin")
.currentOp({"command.sleep": 1, active: true})
@@ -43,20 +43,19 @@
}));
`);
- // Wait to see the getMore waiting on the lock.
- assert.soon(
- () =>
- db.currentOp({"command.getMore": cursorId, waitingForLock: true}).inprog.length === 1);
+// Wait to see the getMore waiting on the lock.
+assert.soon(
+ () => db.currentOp({"command.getMore": cursorId, waitingForLock: true}).inprog.length === 1);
- // Sleep for twice the maxTimeMS to prove that the getMore won't time out waiting for the lock.
- sleep(2 * getMoreMaxTimeMS);
+// Sleep for twice the maxTimeMS to prove that the getMore won't time out waiting for the lock.
+sleep(2 * getMoreMaxTimeMS);
- // Then kill the command with the lock, allowing the getMore to continue successfully.
- const sleepOps = db.getSiblingDB("admin").currentOp({"command.sleep": 1, active: true}).inprog;
- assert.eq(sleepOps.length, 1);
- const sleepOpId = sleepOps[0].opid;
- assert.commandWorked(db.adminCommand({killOp: 1, op: sleepOpId}));
+// Then kill the command with the lock, allowing the getMore to continue successfully.
+const sleepOps = db.getSiblingDB("admin").currentOp({"command.sleep": 1, active: true}).inprog;
+assert.eq(sleepOps.length, 1);
+const sleepOpId = sleepOps[0].opid;
+assert.commandWorked(db.adminCommand({killOp: 1, op: sleepOpId}));
- awaitSleepShell();
- awaitGetMoreShell();
+awaitSleepShell();
+awaitGetMoreShell();
}());