summaryrefslogtreecommitdiff
path: root/jstests/core/connection_status.js
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-01-14 14:09:42 -0500
committerRandolph Tan <randolph@10gen.com>2014-02-28 16:26:33 -0500
commit5595b945603b0712c537787e31e6da661c424fee (patch)
tree90945ee3fe4931032f3af2d397bb755fbf5d30ef /jstests/core/connection_status.js
parentcd62080dcb036e83f8fca6d68d9bcab67bf7a21c (diff)
downloadmongo-5595b945603b0712c537787e31e6da661c424fee.tar.gz
SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
Diffstat (limited to 'jstests/core/connection_status.js')
-rw-r--r--jstests/core/connection_status.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/jstests/core/connection_status.js b/jstests/core/connection_status.js
new file mode 100644
index 00000000000..08d05cbf28d
--- /dev/null
+++ b/jstests/core/connection_status.js
@@ -0,0 +1,27 @@
+// Tests the connectionStatus command
+
+var dbName = 'connection_status';
+var myDB = db.getSiblingDB(dbName);
+myDB.dropAllUsers();
+
+function test(userName) {
+ myDB.createUser({user: userName, pwd: "weak password", roles: jsTest.basicUserRoles});
+ myDB.auth(userName, "weak password");
+
+ var output = myDB.runCommand("connectionStatus");
+ assert.commandWorked(output);
+ var users = output.authInfo.authenticatedUsers;
+
+ var matches = 0;
+ for (var i=0; i < users.length; i++) {
+ if (users[i].db != dbName)
+ continue;
+
+ assert.eq(users[i].user, userName);
+ matches++;
+ }
+ assert.eq(matches, 1);
+}
+
+test("someone");
+test("someone else"); // replaces someone