summaryrefslogtreecommitdiff
path: root/jstests/sharding/shard_aware_primary_failover.js
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2016-06-08 10:29:08 -0400
committerEsha Maharishi <esha.maharishi@mongodb.com>2016-09-15 13:10:09 -0400
commit1c592614126c2eae76508d8771c7e17c11474220 (patch)
treeb6912559b7be7d736546020745efd9e5c834e075 /jstests/sharding/shard_aware_primary_failover.js
parent1116c9d3d903e103d2fc6c3ce792134808cc8691 (diff)
downloadmongo-1c592614126c2eae76508d8771c7e17c11474220.tar.gz
SERVER-24463 make upsert commands in shard_aware*.js tests mimic the command sent by the config server
Diffstat (limited to 'jstests/sharding/shard_aware_primary_failover.js')
-rw-r--r--jstests/sharding/shard_aware_primary_failover.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/jstests/sharding/shard_aware_primary_failover.js b/jstests/sharding/shard_aware_primary_failover.js
index 127e74b948c..934d4dc5600 100644
--- a/jstests/sharding/shard_aware_primary_failover.js
+++ b/jstests/sharding/shard_aware_primary_failover.js
@@ -29,8 +29,17 @@
clusterId: ObjectId()
};
- assert.writeOK(primaryConn.getDB('admin').system.version.insert(
- shardIdentityDoc, {writeConcern: {w: 'majority'}}));
+ // Simulate the upsert that is performed by a config server on addShard.
+ var shardIdentityQuery = {
+ _id: shardIdentityDoc._id,
+ shardName: shardIdentityDoc.shardName,
+ clusterId: shardIdentityDoc.clusterId
+ };
+ var shardIdentityUpdate = {
+ $set: {configsvrConnectionString: shardIdentityDoc.configsvrConnectionString}
+ };
+ assert.writeOK(primaryConn.getDB('admin').system.version.update(
+ shardIdentityQuery, shardIdentityUpdate, {upsert: true, writeConcern: {w: 'majority'}}));
replTest.stopMaster();
replTest.waitForMaster();