diff options
author | Randolph Tan <randolph@10gen.com> | 2020-04-02 16:02:52 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-14 22:02:54 +0000 |
commit | eb939801412d100b3d0a09ab9dacfc1c64694395 (patch) | |
tree | 788676aa8a2585440b19e49d5c201f9c124c9f61 /jstests/sharding/drop_configdb.js | |
parent | d0b9ca3aa8015954b9d0fa4f2f14c142c32625f5 (diff) | |
download | mongo-eb939801412d100b3d0a09ab9dacfc1c64694395.tar.gz |
SERVER-35804 Disallow dropping config and admin from mongos
Diffstat (limited to 'jstests/sharding/drop_configdb.js')
-rw-r--r-- | jstests/sharding/drop_configdb.js | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/jstests/sharding/drop_configdb.js b/jstests/sharding/drop_configdb.js index 180741530b9..5e2b704cf6d 100644 --- a/jstests/sharding/drop_configdb.js +++ b/jstests/sharding/drop_configdb.js @@ -3,17 +3,9 @@ (function() { "use strict"; -var getConfigsvrToWriteTo = function(st) { - if (st.configRS) { - return st.configRS.getPrimary(); - } else { - return st._configServers[0]; - } -}; - var st = new ShardingTest({shards: 2}); var mongos = st.s; -var config = getConfigsvrToWriteTo(st).getDB('config'); +var config = st.configRS.getPrimary().getDB('config'); // Try to drop config db via configsvr @@ -26,10 +18,8 @@ assert.eq("Cannot drop 'config' database if mongod started with --configsvr", var config = mongos.getDB("config"); print("1: Try to drop config database via mongos"); -assert.eq(0, config.dropDatabase().ok); - -// 20 = ErrorCodes::IllegalOperation -assert.eq(20, config.dropDatabase().code); +assert.commandFailedWithCode(config.dropDatabase(), ErrorCodes.IllegalOperation); +assert.commandFailedWithCode(mongos.getDB("admin").dropDatabase(), ErrorCodes.IllegalOperation); st.stop(); -}());
\ No newline at end of file +}()); |