summaryrefslogtreecommitdiff
path: root/jstests/sharding/write_concern_basic.js
blob: 4fcabebae3058bbad63add70667ebed8ee84a955 (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 certain basic commands preserve write concern errors.
// @tags: [ requires_fcv_49, ]
//

(function() {
"use strict";

load("jstests/sharding/libs/failpoint_helpers.js");

let st = new ShardingTest({shards: 2});

// Test drop collection
{
    let db = st.s.getDB("test");
    // _shardsvrDropCollectionParticipant required for PM-1965
    failCommandsWithWriteConcernError(st.rs0, ["drop", "_shardsvrDropCollectionParticipant"]);
    assert.commandWorked(db.collection.insert({"a": 1}));
    assert.commandFailedWithCode(db.runCommand({drop: "collection"}), 12345);
    turnOffFailCommand(st.rs0);
}

// Test drop database
{
    let db = st.s.getDB("test");
    // _shardsvrDropDatabaseParticipant required for PM-1965
    failCommandsWithWriteConcernError(st.rs1, ["dropDatabase", "_shardsvrDropDatabaseParticipant"]);
    assert.commandWorked(db.collection.insert({"a": 1}));
    st.ensurePrimaryShard("test", st.shard0.shardName);
    assert.commandFailedWithCode(db.runCommand({"dropDatabase": 1}), 12345);
    turnOffFailCommand(st.rs1);
}

st.stop();
})();