summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/cursor_server_status_metrics.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:42:24 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-26 18:42:24 -0400
commitc1a45ebbb0530e3d0201321d725527f1eb83ffce (patch)
treef523079dc5ded3052eefbdcaae424b7502df5b25 /jstests/noPassthroughWithMongod/cursor_server_status_metrics.js
parentc9599d8610c3da0b7c3da65667aff821063cf5b9 (diff)
downloadmongo-c1a45ebbb0530e3d0201321d725527f1eb83ffce.tar.gz
Apply formatting per `clang-format-7.0.1`
Diffstat (limited to 'jstests/noPassthroughWithMongod/cursor_server_status_metrics.js')
-rw-r--r--jstests/noPassthroughWithMongod/cursor_server_status_metrics.js136
1 files changed, 68 insertions, 68 deletions
diff --git a/jstests/noPassthroughWithMongod/cursor_server_status_metrics.js b/jstests/noPassthroughWithMongod/cursor_server_status_metrics.js
index b8f8a240662..865809f63b2 100644
--- a/jstests/noPassthroughWithMongod/cursor_server_status_metrics.js
+++ b/jstests/noPassthroughWithMongod/cursor_server_status_metrics.js
@@ -2,85 +2,85 @@
* Tests for serverStatus metrics.cursor stats.
*/
(function() {
- var coll = db[jsTest.name()];
- coll.drop();
- assert.writeOK(coll.insert({_id: 1}));
- assert.writeOK(coll.insert({_id: 2}));
- assert.writeOK(coll.insert({_id: 3}));
+var coll = db[jsTest.name()];
+coll.drop();
+assert.writeOK(coll.insert({_id: 1}));
+assert.writeOK(coll.insert({_id: 2}));
+assert.writeOK(coll.insert({_id: 3}));
- assert.eq(3, coll.find().count());
+assert.eq(3, coll.find().count());
- function getCurrentCursorsOpen() {
- return db.serverStatus().metrics.cursor.open.total;
- }
+function getCurrentCursorsOpen() {
+ return db.serverStatus().metrics.cursor.open.total;
+}
- function getCurrentCursorsPinned() {
- return db.serverStatus().metrics.cursor.open.pinned;
- }
+function getCurrentCursorsPinned() {
+ return db.serverStatus().metrics.cursor.open.pinned;
+}
- var initialTotalOpen = getCurrentCursorsOpen();
+var initialTotalOpen = getCurrentCursorsOpen();
- // We expect no pinned cursors
- assert.eq(0, getCurrentCursorsPinned());
+// We expect no pinned cursors
+assert.eq(0, getCurrentCursorsPinned());
- // Total open cursors should not have changed after exhausting a cursor.
- assert.eq(3, coll.find().itcount());
- assert.eq(initialTotalOpen, getCurrentCursorsOpen());
- assert.eq(3, coll.find().batchSize(2).itcount());
- assert.eq(initialTotalOpen, getCurrentCursorsOpen());
- assert.eq(3, coll.find().batchSize(1).itcount());
- assert.eq(initialTotalOpen, getCurrentCursorsOpen());
+// Total open cursors should not have changed after exhausting a cursor.
+assert.eq(3, coll.find().itcount());
+assert.eq(initialTotalOpen, getCurrentCursorsOpen());
+assert.eq(3, coll.find().batchSize(2).itcount());
+assert.eq(initialTotalOpen, getCurrentCursorsOpen());
+assert.eq(3, coll.find().batchSize(1).itcount());
+assert.eq(initialTotalOpen, getCurrentCursorsOpen());
- assert.eq(3, coll.aggregate([]).itcount());
- assert.eq(initialTotalOpen, getCurrentCursorsOpen());
- assert.eq(3, coll.aggregate([], {cursor: {batchSize: 2}}).itcount());
- assert.eq(initialTotalOpen, getCurrentCursorsOpen());
- assert.eq(3, coll.aggregate([], {cursor: {batchSize: 1}}).itcount());
- assert.eq(initialTotalOpen, getCurrentCursorsOpen());
+assert.eq(3, coll.aggregate([]).itcount());
+assert.eq(initialTotalOpen, getCurrentCursorsOpen());
+assert.eq(3, coll.aggregate([], {cursor: {batchSize: 2}}).itcount());
+assert.eq(initialTotalOpen, getCurrentCursorsOpen());
+assert.eq(3, coll.aggregate([], {cursor: {batchSize: 1}}).itcount());
+assert.eq(initialTotalOpen, getCurrentCursorsOpen());
- // Total pinned cursors should remain zero exhausting a cursor.
- assert.eq(3, coll.find().itcount());
- assert.eq(0, getCurrentCursorsPinned());
- assert.eq(3, coll.find().batchSize(2).itcount());
- assert.eq(0, getCurrentCursorsPinned());
- assert.eq(3, coll.find().batchSize(1).itcount());
- assert.eq(0, getCurrentCursorsPinned());
+// Total pinned cursors should remain zero exhausting a cursor.
+assert.eq(3, coll.find().itcount());
+assert.eq(0, getCurrentCursorsPinned());
+assert.eq(3, coll.find().batchSize(2).itcount());
+assert.eq(0, getCurrentCursorsPinned());
+assert.eq(3, coll.find().batchSize(1).itcount());
+assert.eq(0, getCurrentCursorsPinned());
- assert.eq(3, coll.aggregate([]).itcount());
- assert.eq(0, getCurrentCursorsPinned());
- assert.eq(3, coll.aggregate([], {cursor: {batchSize: 2}}).itcount());
- assert.eq(0, getCurrentCursorsPinned());
- assert.eq(3, coll.aggregate([], {cursor: {batchSize: 1}}).itcount());
- assert.eq(0, getCurrentCursorsPinned());
+assert.eq(3, coll.aggregate([]).itcount());
+assert.eq(0, getCurrentCursorsPinned());
+assert.eq(3, coll.aggregate([], {cursor: {batchSize: 2}}).itcount());
+assert.eq(0, getCurrentCursorsPinned());
+assert.eq(3, coll.aggregate([], {cursor: {batchSize: 1}}).itcount());
+assert.eq(0, getCurrentCursorsPinned());
- // This cursor should remain open on the server, but not pinned.
- var cursor = coll.find().batchSize(2);
- cursor.next();
- assert.eq(initialTotalOpen + 1, getCurrentCursorsOpen());
- assert.eq(0, getCurrentCursorsPinned());
+// This cursor should remain open on the server, but not pinned.
+var cursor = coll.find().batchSize(2);
+cursor.next();
+assert.eq(initialTotalOpen + 1, getCurrentCursorsOpen());
+assert.eq(0, getCurrentCursorsPinned());
- // Same should be true after pulling the second document out of the cursor, since we haven't
- // issued a getMore yet.
- cursor.next();
- assert.eq(initialTotalOpen + 1, getCurrentCursorsOpen());
- assert.eq(0, getCurrentCursorsPinned());
+// Same should be true after pulling the second document out of the cursor, since we haven't
+// issued a getMore yet.
+cursor.next();
+assert.eq(initialTotalOpen + 1, getCurrentCursorsOpen());
+assert.eq(0, getCurrentCursorsPinned());
- // Cursor no longer reported as open after being exhausted.
- cursor.next();
- assert(!cursor.hasNext());
- assert.eq(initialTotalOpen, getCurrentCursorsOpen());
- assert.eq(0, getCurrentCursorsPinned());
+// Cursor no longer reported as open after being exhausted.
+cursor.next();
+assert(!cursor.hasNext());
+assert.eq(initialTotalOpen, getCurrentCursorsOpen());
+assert.eq(0, getCurrentCursorsPinned());
- // Same behavior expected for an aggregation cursor.
- var cursor = coll.aggregate([], {cursor: {batchSize: 2}});
- cursor.next();
- assert.eq(initialTotalOpen + 1, getCurrentCursorsOpen());
- assert.eq(0, getCurrentCursorsPinned());
- cursor.next();
- assert.eq(initialTotalOpen + 1, getCurrentCursorsOpen());
- assert.eq(0, getCurrentCursorsPinned());
- cursor.next();
- assert(!cursor.hasNext());
- assert.eq(initialTotalOpen, getCurrentCursorsOpen());
- assert.eq(0, getCurrentCursorsPinned());
+// Same behavior expected for an aggregation cursor.
+var cursor = coll.aggregate([], {cursor: {batchSize: 2}});
+cursor.next();
+assert.eq(initialTotalOpen + 1, getCurrentCursorsOpen());
+assert.eq(0, getCurrentCursorsPinned());
+cursor.next();
+assert.eq(initialTotalOpen + 1, getCurrentCursorsOpen());
+assert.eq(0, getCurrentCursorsPinned());
+cursor.next();
+assert(!cursor.hasNext());
+assert.eq(initialTotalOpen, getCurrentCursorsOpen());
+assert.eq(0, getCurrentCursorsPinned());
}());