0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/sharding/current_op_with_drop_shard.js
2019-01-14 10:58:14 -05:00

26 lines
738 B
JavaScript

// Tests that currentOp is resilient to drop shard.
(function() {
'use strict';
const st = new ShardingTest({shards: 2, rs: {nodes: 1}});
// We need the balancer to remove a shard.
st.startBalancer();
const mongosDB = st.s.getDB(jsTestName());
const shardName = st.shard0.shardName;
var res = st.s.adminCommand({removeShard: shardName});
assert.commandWorked(res);
assert.eq('started', res.state);
assert.soon(function() {
res = st.s.adminCommand({removeShard: shardName});
assert.commandWorked(res);
return ('completed' === res.state);
}, "removeShard never completed for shard " + shardName);
assert.commandWorked(mongosDB.currentOp());
st.stop();
})();