summaryrefslogtreecommitdiff
path: root/jstests/auth/upgrade_noauth_to_keyfile.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/auth/upgrade_noauth_to_keyfile.js')
-rw-r--r--jstests/auth/upgrade_noauth_to_keyfile.js64
1 files changed, 32 insertions, 32 deletions
diff --git a/jstests/auth/upgrade_noauth_to_keyfile.js b/jstests/auth/upgrade_noauth_to_keyfile.js
index 9bf2ec115e6..41eef5612c8 100644
--- a/jstests/auth/upgrade_noauth_to_keyfile.js
+++ b/jstests/auth/upgrade_noauth_to_keyfile.js
@@ -13,46 +13,46 @@ load('jstests/multiVersion/libs/multi_rs.js');
TestData.skipGossipingClusterTime = true;
(function() {
- 'use strict';
- var keyFilePath = 'jstests/libs/key1';
+'use strict';
+var keyFilePath = 'jstests/libs/key1';
- // Disable auth explicitly
- var noAuthOptions = {noauth: ''};
+// Disable auth explicitly
+var noAuthOptions = {noauth: ''};
- // Undefine the flags we're replacing, otherwise upgradeSet will keep old values.
- var transitionToAuthOptions =
- {noauth: undefined, clusterAuthMode: 'keyFile', keyFile: keyFilePath, transitionToAuth: ''};
- var keyFileOptions = {
- clusterAuthMode: 'keyFile',
- keyFile: keyFilePath,
- transitionToAuth: undefined
- };
+// Undefine the flags we're replacing, otherwise upgradeSet will keep old values.
+var transitionToAuthOptions =
+ {noauth: undefined, clusterAuthMode: 'keyFile', keyFile: keyFilePath, transitionToAuth: ''};
+var keyFileOptions = {
+ clusterAuthMode: 'keyFile',
+ keyFile: keyFilePath,
+ transitionToAuth: undefined
+};
- var rst = new ReplSetTest({name: 'noauthSet', nodes: 3, nodeOptions: noAuthOptions});
- rst.startSet();
- rst.initiate();
+var rst = new ReplSetTest({name: 'noauthSet', nodes: 3, nodeOptions: noAuthOptions});
+rst.startSet();
+rst.initiate();
- var rstConn1 = rst.getPrimary();
+var rstConn1 = rst.getPrimary();
- // Create a user to login as when auth is enabled later
- rstConn1.getDB('admin').createUser({user: 'root', pwd: 'root', roles: ['root']});
+// Create a user to login as when auth is enabled later
+rstConn1.getDB('admin').createUser({user: 'root', pwd: 'root', roles: ['root']});
- rstConn1.getDB('test').a.insert({a: 1, str: 'TESTTESTTEST'});
- assert.eq(1, rstConn1.getDB('test').a.count(), 'Error interacting with replSet');
+rstConn1.getDB('test').a.insert({a: 1, str: 'TESTTESTTEST'});
+assert.eq(1, rstConn1.getDB('test').a.count(), 'Error interacting with replSet');
- print('=== UPGRADE noauth -> transitionToAuth/keyFile ===');
- rst.upgradeSet(transitionToAuthOptions);
- var rstConn2 = rst.getPrimary();
- rstConn2.getDB('test').a.insert({a: 1, str: 'TESTTESTTEST'});
- assert.eq(2, rstConn2.getDB('test').a.count(), 'Error interacting with replSet');
+print('=== UPGRADE noauth -> transitionToAuth/keyFile ===');
+rst.upgradeSet(transitionToAuthOptions);
+var rstConn2 = rst.getPrimary();
+rstConn2.getDB('test').a.insert({a: 1, str: 'TESTTESTTEST'});
+assert.eq(2, rstConn2.getDB('test').a.count(), 'Error interacting with replSet');
- print('=== UPGRADE transitionToAuth/keyFile -> keyFile ===');
- rst.upgradeSet(keyFileOptions, 'root', 'root');
+print('=== UPGRADE transitionToAuth/keyFile -> keyFile ===');
+rst.upgradeSet(keyFileOptions, 'root', 'root');
- // upgradeSet leaves its connections logged in as root
- var rstConn3 = rst.getPrimary();
- rstConn3.getDB('test').a.insert({a: 1, str: 'TESTTESTTEST'});
- assert.eq(3, rstConn3.getDB('test').a.count(), 'Error interacting with replSet');
+// upgradeSet leaves its connections logged in as root
+var rstConn3 = rst.getPrimary();
+rstConn3.getDB('test').a.insert({a: 1, str: 'TESTTESTTEST'});
+assert.eq(3, rstConn3.getDB('test').a.count(), 'Error interacting with replSet');
- rst.stopSet();
+rst.stopSet();
}());