blob: 0163e521c657c92e53cbf0bab8e49d7054321eea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/**
* Test that setShardVersion fails if sent to the config server.
*/
(function() {
"use strict";
var st = new ShardingTest({shards: 1});
var testDB = st.s.getDB('test');
testDB.adminCommand({enableSharding: 'test'});
testDB.adminCommand({shardCollection: 'test.user', key: {x: 1}});
testDB.user.insert({x: 1});
var directConn = new Mongo(st.rs0.getPrimary().host);
var adminDB = directConn.getDB('admin');
var configStr = adminDB.runCommand({getShardVersion: 'test.user'}).configServer;
var configAdmin = st.c0.getDB('admin');
jsTest.log("Verify that setShardVersion fails on the config server");
// Even if shardName sent is 'config' and connstring sent is config server's actual connstring.
assert.commandFailedWithCode(configAdmin.runCommand({
setShardVersion: '',
init: true,
authoritative: true,
configdb: configStr,
shard: 'config'
}),
ErrorCodes.NoShardingEnabled);
st.stop();
})();
|