summaryrefslogtreecommitdiff
path: root/jstests/core
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2020-07-17 15:26:30 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-17 19:53:53 +0000
commit2a4a2def40803f7dbdfa3ec21f0c178a5a16e259 (patch)
tree73c7b1ae5afe6fb68af07d9a8fc273d02c47faa7 /jstests/core
parent800524cff59a23d93e30bfc931042cfb03e5ff76 (diff)
downloadmongo-2a4a2def40803f7dbdfa3ec21f0c178a5a16e259.tar.gz
SERVER-49521 fix writeConcern for non-txn createIndexes commands in core/txns tests
Diffstat (limited to 'jstests/core')
-rw-r--r--jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js3
-rw-r--r--jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js9
-rw-r--r--jstests/core/txns/read_own_multikey_writes.js6
3 files changed, 14 insertions, 4 deletions
diff --git a/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js b/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js
index ebf1b232ff7..ef03baab8cd 100644
--- a/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js
+++ b/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js
@@ -24,7 +24,8 @@ if (isMongos) {
const createIndexesCommand = {
createIndexes: collName,
- indexes: [{key: {a: 1}, name: "a_1"}]
+ indexes: [{key: {a: 1}, name: "a_1"}],
+ writeConcern: {w: 'majority'},
};
assert.commandWorked(sessionDB.runCommand(createIndexesCommand));
diff --git a/jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js b/jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js
index 0458f213960..1f13af52e0f 100644
--- a/jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js
+++ b/jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js
@@ -40,7 +40,8 @@ testSuccess(otherDBName, createCmd);
jsTest.log("Test 'createIndexes'.");
const createIndexesCmd = {
createIndexes: collName,
- indexes: [{key: {x: 1}, name: "x_1"}]
+ indexes: [{key: {x: 1}, name: "x_1"}],
+ writeConcern: {w: 'majority'},
};
testSuccess(otherDBName, createIndexesCmd);
@@ -51,7 +52,11 @@ const dropIndexesCmd = {
};
testSuccess(otherDBName, dropIndexesCmd);
-sessionColl.createIndex({multiKeyField: 1});
+assert.commandWorked(sessionDB.runCommand({
+ createIndexes: collName,
+ indexes: [{name: 'multiKeyField_1', key: {multiKeyField: 1}}],
+ writeConcern: {w: 'majority'},
+}));
jsTest.log("Test 'insert' that enables multi-key index on the same collection.");
const insertAndSetMultiKeyCmd = {
insert: collName,
diff --git a/jstests/core/txns/read_own_multikey_writes.js b/jstests/core/txns/read_own_multikey_writes.js
index 1c3dc450280..0def1cdf759 100644
--- a/jstests/core/txns/read_own_multikey_writes.js
+++ b/jstests/core/txns/read_own_multikey_writes.js
@@ -16,7 +16,11 @@ const sessionColl = sessionDb.getCollection(collName);
assert.commandWorked(sessionDb.runCommand({create: collName}));
assert.commandWorked(sessionColl.insert({a: 1}));
-assert.commandWorked(sessionColl.createIndex({a: 1}));
+assert.commandWorked(sessionDb.runCommand({
+ createIndexes: collName,
+ indexes: [{name: 'a_1', key: {a: 1}}],
+ writeConcern: {w: 'majority'},
+}));
session.startTransaction();
assert.commandWorked(sessionColl.update({}, {$set: {a: [1, 2, 3]}}));