summaryrefslogtreecommitdiff
path: root/jstests/sharding/current_op_with_drop_shard.js
blob: c6f9e7cad90306e8ecf16e6dff04290bbfd94285 (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
// 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();
})();