diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/noPassthrough/logical_session_cursor_checks.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/noPassthrough/logical_session_cursor_checks.js')
-rw-r--r-- | jstests/noPassthrough/logical_session_cursor_checks.js | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/jstests/noPassthrough/logical_session_cursor_checks.js b/jstests/noPassthrough/logical_session_cursor_checks.js index a12f46fc583..5664fb1ef28 100644 --- a/jstests/noPassthrough/logical_session_cursor_checks.js +++ b/jstests/noPassthrough/logical_session_cursor_checks.js @@ -1,97 +1,97 @@ // @tags: [requires_sharding] (function() { - 'use strict'; - - function runFixture(Fixture) { - var fixture = new Fixture(); - var conn = fixture.getConn(); - var admin = conn.getDB("admin"); - var data = conn.getDB("data_storage"); - - admin.createUser({user: 'admin', pwd: 'admin', roles: jsTest.adminUserRoles}); - admin.auth("admin", "admin"); - data.createUser({user: 'admin', pwd: 'admin', roles: jsTest.basicUserRoles}); - data.createUser({user: 'user0', pwd: 'password', roles: jsTest.basicUserRoles}); - admin.logout(); - - data.auth("user0", "password"); - assert.writeOK(data.test.insert({name: "first", data: 1})); - assert.writeOK(data.test.insert({name: "second", data: 2})); - - // Test that getMore works correctly on the same session. - { - var session1 = conn.startSession(); - var session2 = conn.startSession(); - var res = assert.commandWorked( - session1.getDatabase("data_storage").runCommand({find: "test", batchSize: 0})); - var cursorId = res.cursor.id; - assert.commandWorked(session1.getDatabase("data_storage") - .runCommand({getMore: cursorId, collection: "test"})); - - session2.endSession(); - session1.endSession(); - } - - // Test that getMore correctly gives an error, when using a cursor on a different session. - { - var session1 = conn.startSession(); - var session2 = conn.startSession(); - var res = assert.commandWorked( - session1.getDatabase("data_storage").runCommand({find: "test", batchSize: 0})); - var cursorId = res.cursor.id; - assert.commandFailed(session2.getDatabase("data_storage") - .runCommand({getMore: cursorId, collection: "test"})); - - session2.endSession(); - session1.endSession(); - } - - // Test that query.js driven getMore works correctly on the same session. - { - var session1 = conn.startSession(); - var session2 = conn.startSession(); - var cursor = session1.getDatabase("data_storage").test.find({}).batchSize(1); - cursor.next(); - cursor.next(); - cursor.close(); - - session2.endSession(); - session1.endSession(); - } - - fixture.stop(); +'use strict'; + +function runFixture(Fixture) { + var fixture = new Fixture(); + var conn = fixture.getConn(); + var admin = conn.getDB("admin"); + var data = conn.getDB("data_storage"); + + admin.createUser({user: 'admin', pwd: 'admin', roles: jsTest.adminUserRoles}); + admin.auth("admin", "admin"); + data.createUser({user: 'admin', pwd: 'admin', roles: jsTest.basicUserRoles}); + data.createUser({user: 'user0', pwd: 'password', roles: jsTest.basicUserRoles}); + admin.logout(); + + data.auth("user0", "password"); + assert.writeOK(data.test.insert({name: "first", data: 1})); + assert.writeOK(data.test.insert({name: "second", data: 2})); + + // Test that getMore works correctly on the same session. + { + var session1 = conn.startSession(); + var session2 = conn.startSession(); + var res = assert.commandWorked( + session1.getDatabase("data_storage").runCommand({find: "test", batchSize: 0})); + var cursorId = res.cursor.id; + assert.commandWorked(session1.getDatabase("data_storage") + .runCommand({getMore: cursorId, collection: "test"})); + + session2.endSession(); + session1.endSession(); } - function Standalone() { - this.standalone = MongoRunner.runMongod({auth: "", nojournal: ""}); + // Test that getMore correctly gives an error, when using a cursor on a different session. + { + var session1 = conn.startSession(); + var session2 = conn.startSession(); + var res = assert.commandWorked( + session1.getDatabase("data_storage").runCommand({find: "test", batchSize: 0})); + var cursorId = res.cursor.id; + assert.commandFailed(session2.getDatabase("data_storage") + .runCommand({getMore: cursorId, collection: "test"})); + + session2.endSession(); + session1.endSession(); } - Standalone.prototype.stop = function() { - MongoRunner.stopMongod(this.standalone); - }; - - Standalone.prototype.getConn = function() { - return this.standalone; - }; - - function Sharding() { - // TODO: Remove 'shardAsReplicaSet: false' when SERVER-32672 is fixed. - this.st = new ShardingTest({ - shards: 1, - config: 1, - mongos: 1, - other: {keyFile: 'jstests/libs/key1', shardAsReplicaSet: false} - }); + // Test that query.js driven getMore works correctly on the same session. + { + var session1 = conn.startSession(); + var session2 = conn.startSession(); + var cursor = session1.getDatabase("data_storage").test.find({}).batchSize(1); + cursor.next(); + cursor.next(); + cursor.close(); + + session2.endSession(); + session1.endSession(); } - Sharding.prototype.stop = function() { - this.st.stop(); - }; + fixture.stop(); +} - Sharding.prototype.getConn = function() { - return this.st.s0; - }; +function Standalone() { + this.standalone = MongoRunner.runMongod({auth: "", nojournal: ""}); +} - [Standalone, Sharding].forEach(runFixture); +Standalone.prototype.stop = function() { + MongoRunner.stopMongod(this.standalone); +}; + +Standalone.prototype.getConn = function() { + return this.standalone; +}; + +function Sharding() { + // TODO: Remove 'shardAsReplicaSet: false' when SERVER-32672 is fixed. + this.st = new ShardingTest({ + shards: 1, + config: 1, + mongos: 1, + other: {keyFile: 'jstests/libs/key1', shardAsReplicaSet: false} + }); +} + +Sharding.prototype.stop = function() { + this.st.stop(); +}; + +Sharding.prototype.getConn = function() { + return this.st.s0; +}; + +[Standalone, Sharding].forEach(runFixture); })(); |