diff options
author | Irina Yatsenko <irina.yatsenko@mongodb.com> | 2021-06-02 00:46:16 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-02 01:18:12 +0000 |
commit | 911e585044f76bb244f425066bfcb838e9dfb258 (patch) | |
tree | ed3979524ade6abdc931afdfc62f6200e2b3f7f6 | |
parent | 2da60c28f0996433e61e80ac5cfdde621244837e (diff) | |
download | mongo-911e585044f76bb244f425066bfcb838e9dfb258.tar.gz |
SERVER-57198 Remove getLastError calls from tests where it's easy to do so
33 files changed, 29 insertions, 111 deletions
diff --git a/buildscripts/resmokeconfig/suites/causally_consistent_hedged_reads_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/causally_consistent_hedged_reads_jscore_passthrough.yml index f09faea9ac0..b9dfef57a23 100644 --- a/buildscripts/resmokeconfig/suites/causally_consistent_hedged_reads_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/causally_consistent_hedged_reads_jscore_passthrough.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml index 5ea76b5390c..0870fb91fad 100644 --- a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml index 8511fbff220..ff6129048ab 100644 --- a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml +++ b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml @@ -28,7 +28,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_100ms_refresh_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_100ms_refresh_jscore_passthrough.yml index db550645cae..293de9433d4 100644 --- a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_100ms_refresh_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_100ms_refresh_jscore_passthrough.yml @@ -17,7 +17,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_10sec_refresh_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_10sec_refresh_jscore_passthrough.yml index 38216d7216e..050d00d3f03 100644 --- a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_10sec_refresh_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_10sec_refresh_jscore_passthrough.yml @@ -17,7 +17,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_1sec_refresh_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_1sec_refresh_jscore_passthrough.yml index bf4f2f10cc0..cd431dc425b 100644 --- a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_1sec_refresh_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_1sec_refresh_jscore_passthrough.yml @@ -17,7 +17,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_default_refresh_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_default_refresh_jscore_passthrough.yml index ae93b8fc620..850b184fca0 100644 --- a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_default_refresh_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_default_refresh_jscore_passthrough.yml @@ -17,7 +17,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/multi_shard_local_read_write_multi_stmt_txn_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/multi_shard_local_read_write_multi_stmt_txn_jscore_passthrough.yml index 4a5f3d1d24a..33704775f39 100644 --- a/buildscripts/resmokeconfig/suites/multi_shard_local_read_write_multi_stmt_txn_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/multi_shard_local_read_write_multi_stmt_txn_jscore_passthrough.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_jscore_passthrough.yml index 3c5c0651e7d..118a7cb6efb 100644 --- a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_jscore_passthrough.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough.yml index 9867c09384a..adfcbfb8cfe 100644 --- a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough.yml index 23ea6a7f2b4..3aad76dc09c 100644 --- a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/multi_stmt_txn_jscore_passthrough_with_migration.yml b/buildscripts/resmokeconfig/suites/multi_stmt_txn_jscore_passthrough_with_migration.yml index d26031bdd89..8e6e002333a 100644 --- a/buildscripts/resmokeconfig/suites/multi_stmt_txn_jscore_passthrough_with_migration.yml +++ b/buildscripts/resmokeconfig/suites/multi_stmt_txn_jscore_passthrough_with_migration.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml index ead6263279a..25ad4278d71 100644 --- a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_read_concern_snapshot_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_read_concern_snapshot_passthrough.yml index 242cf97b557..31fcbb8284a 100644 --- a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_read_concern_snapshot_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_read_concern_snapshot_passthrough.yml @@ -18,7 +18,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml index 10f59eab608..496e207c13e 100644 --- a/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml @@ -19,7 +19,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/sharded_multi_stmt_txn_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_multi_stmt_txn_jscore_passthrough.yml index 9689d16ec5d..9dac296e328 100644 --- a/buildscripts/resmokeconfig/suites/sharded_multi_stmt_txn_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharded_multi_stmt_txn_jscore_passthrough.yml @@ -16,7 +16,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml index 46b9eed4937..f260fd127b6 100644 --- a/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml @@ -15,7 +15,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml index e2ab3db291e..e965bf8f2e0 100644 --- a/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml @@ -16,7 +16,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/buildscripts/resmokeconfig/suites/sharding_update_v1_oplog_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_update_v1_oplog_jscore_passthrough.yml index a2d5115253b..fe7d9eb58d0 100644 --- a/buildscripts/resmokeconfig/suites/sharding_update_v1_oplog_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharding_update_v1_oplog_jscore_passthrough.yml @@ -15,7 +15,6 @@ selector: - jstests/core/currentop.js # uses fsync. - jstests/core/dbhash.js # dbhash. - jstests/core/dbhash2.js # dbhash. - - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. diff --git a/jstests/auth/resource_pattern_matching.js b/jstests/auth/resource_pattern_matching.js index 7261890ef9d..b02fe7951e6 100644 --- a/jstests/auth/resource_pattern_matching.js +++ b/jstests/auth/resource_pattern_matching.js @@ -28,16 +28,14 @@ function setup_dbs_and_cols(db) { var test_db_a = db.getSiblingDB("a"); var test_db_b = db.getSiblingDB("b"); - test_db_a.dropDatabase(); - test_db_b.dropDatabase(); + assert.commandWorked(test_db_a.dropDatabase({w: 'majority'})); + assert.commandWorked(test_db_b.dropDatabase({w: 'majority'})); - test_db_a.createCollection("a"); - test_db_a.createCollection("b"); + assert.commandWorked(test_db_a.createCollection("a", {writeConcern: {w: 'majority'}})); + assert.commandWorked(test_db_a.createCollection("b", {writeConcern: {w: 'majority'}})); - test_db_b.createCollection("a"); - test_db_b.createCollection("b"); - - db.getLastError('majority'); + assert.commandWorked(test_db_b.createCollection("a", {writeConcern: {w: 'majority'}})); + assert.commandWorked(test_db_b.createCollection("b", {writeConcern: {w: 'majority'}})); } function grant_privileges(granter, privileges) { diff --git a/jstests/auth/user_defined_roles_on_secondaries.js b/jstests/auth/user_defined_roles_on_secondaries.js index d05d44ff749..4d44a9bbfd0 100644 --- a/jstests/auth/user_defined_roles_on_secondaries.js +++ b/jstests/auth/user_defined_roles_on_secondaries.js @@ -214,7 +214,8 @@ assert.commandWorked(rstest.getPrimary().getDB("admin").runCommand({ ] })); -assert.commandWorked(rstest.getPrimary().getDB("admin").getLastErrorObj(2)); +rstest.awaitReplication(); + rstest.nodes.forEach(function(node) { var role = node.getDB("db1").getRole("t1"); assert.eq(1, role.roles.length, tojson(node)); diff --git a/jstests/core/dropdb_race.js b/jstests/core/dropdb_race.js deleted file mode 100644 index 8f1356db1d6..00000000000 --- a/jstests/core/dropdb_race.js +++ /dev/null @@ -1,47 +0,0 @@ -// test dropping a db with simultaneous commits -// -// @tags: [ -// assumes_superuser_permissions, -// assumes_write_concern_unchanged, -// does_not_support_stepdowns, -// ] - -m = db.getMongo(); -baseName = "jstests_dur_droprace"; -d = db.getSiblingDB(baseName); -t = d.foo; - -assert(d.adminCommand({setParameter: 1, syncdelay: 5}).ok); - -var s = 0; - -var start = new Date(); - -for (var pass = 0; pass < 100; pass++) { - if (pass % 2 == 0) { - // sometimes wait for create db first, to vary the timing of things - var options = (pass % 4 == 0) ? {writeConcern: {fsync: true}} : undefined; - t.insert({}, options); - } - t.insert({x: 1}); - t.insert({x: 3}); - t.createIndex({x: 1}); - sleep(s); - if (pass % 13 == 0) - t.drop(); - else if (pass % 17 == 0) - t.dropIndexes(); - else - d.dropDatabase(); - - if (pass % 7 == 0) - d.runCommand({getLastError: 1, j: 1}); - - d.getLastError(); - s = (s + 1) % 25; - // print(pass); - if ((new Date()) - start > 60000) { - print("stopping early"); - break; - } -} diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js index 69ce00b4670..a898503d345 100644 --- a/jstests/libs/parallelTester.js +++ b/jstests/libs/parallelTester.js @@ -167,7 +167,6 @@ if (typeof _threadInject != "undefined") { // These tests use the getLastError command, which is unsafe to use in this environment, // since a previous test's cursors could be garbage collected in the middle of the next // test, which would reset the last error associated with the shell's client. - "dropdb_race.js", "bulk_legacy_enforce_gle.js", // These tests use getLog to examine the logs. Tests which do so shouldn't be run in diff --git a/jstests/libs/test_background_ops.js b/jstests/libs/test_background_ops.js index 1393871e1ab..1d324a4862a 100644 --- a/jstests/libs/test_background_ops.js +++ b/jstests/libs/test_background_ops.js @@ -171,16 +171,14 @@ startParallelOps = function(mongo, proc, args, context) { var testDataColl = mongo.getCollection("config.parallelTest"); - testDataColl.insert({ + assert.commandWorked(testDataColl.insert({ _id: procName, bootstrapper: tojson(bootstrapper), operation: tojson(proc), args: tojson(args), procContext: tojson(procContext), contexts: tojson(contexts) - }); - - assert.eq(null, testDataColl.getDB().getLastError()); + })); var bootstrapStartup = "{ var procName = '" + procName + "'; " + "var stored = db.getMongo().getCollection( '" + testDataColl + "' )" + diff --git a/jstests/multiVersion/genericSetFCVUsage/3_upgrade_replset.js b/jstests/multiVersion/genericSetFCVUsage/3_upgrade_replset.js index 3699cf45218..976a2f01c52 100644 --- a/jstests/multiVersion/genericSetFCVUsage/3_upgrade_replset.js +++ b/jstests/multiVersion/genericSetFCVUsage/3_upgrade_replset.js @@ -34,8 +34,7 @@ for (let oldVersion of ["last-lts", "last-continuous"]) { while (!isFinished()) { try { - coll.insert({_id: count, hello: "world"}); - assert.eq(null, coll.getDB().getLastError()); + assert.commandWorked(coll.insert({_id: count, hello: "world"})); assert.neq(null, coll.findOne({_id: count})); } catch (e) { printjson(e); diff --git a/jstests/multiVersion/libs/verify_collection_data.js b/jstests/multiVersion/libs/verify_collection_data.js index ea2ef2f3f35..808a3517362 100644 --- a/jstests/multiVersion/libs/verify_collection_data.js +++ b/jstests/multiVersion/libs/verify_collection_data.js @@ -52,8 +52,7 @@ createCollectionWithData = function(db, collectionName, dataGenerator) { // matters here since we can use indexes nextDoc._id = numInserted; print("collection.insert(" + JSON.stringify(nextDoc) + ");"); - var insertResult = collection.insert(nextDoc); - assert(db.getLastError() == null); + assert.commandWorked(collection.insert(nextDoc)); numInserted++; } diff --git a/jstests/multiVersion/migration_between_mixed_version_mongods.js b/jstests/multiVersion/migration_between_mixed_version_mongods.js index b855c65f02d..9bde5a67987 100644 --- a/jstests/multiVersion/migration_between_mixed_version_mongods.js +++ b/jstests/multiVersion/migration_between_mixed_version_mongods.js @@ -53,18 +53,14 @@ assert.commandWorked(admin.runCommand({split: fooNS, middle: {a: 10}})); assert.commandWorked(admin.runCommand({shardCollection: barNS, key: {a: 1}})); assert.commandWorked(admin.runCommand({split: barNS, middle: {a: 10}})); -fooColl.insert({a: 0}); -assert.eq(null, fooColl.getDB().getLastError()); -fooColl.insert({a: 10}); -assert.eq(null, fooColl.getDB().getLastError()); +assert.commandWorked(fooColl.insert({a: 0})); +assert.commandWorked(fooColl.insert({a: 10})); assert.eq(0, fooRecipientColl.count()); assert.eq(2, fooDonorColl.count()); assert.eq(2, fooColl.count()); -barColl.insert({a: 0}); -assert.eq(null, barColl.getDB().getLastError()); -barColl.insert({a: 10}); -assert.eq(null, barColl.getDB().getLastError()); +assert.commandWorked(barColl.insert({a: 0})); +assert.commandWorked(barColl.insert({a: 10})); assert.eq(0, barRecipientColl.count()); assert.eq(2, barDonorColl.count()); assert.eq(2, barColl.count()); diff --git a/jstests/multiVersion/minor_version_upgrade_replset.js b/jstests/multiVersion/minor_version_upgrade_replset.js index 7efb48074e2..a0dffdf776e 100644 --- a/jstests/multiVersion/minor_version_upgrade_replset.js +++ b/jstests/multiVersion/minor_version_upgrade_replset.js @@ -33,8 +33,7 @@ function findAndInsert(rsURL, coll) { while (!isFinished()) { try { - coll.insert({_id: count, hello: "world"}); - assert.eq(null, coll.getDB().getLastError()); + assert.commandWorked(coll.insert({_id: count, hello: "world"})); assert.neq(null, coll.findOne({_id: count})); } catch (e) { printjson(e); diff --git a/jstests/noPassthrough/geo_full.js b/jstests/noPassthrough/geo_full.js index e2cf2b03491..6d8350c04db 100644 --- a/jstests/noPassthrough/geo_full.js +++ b/jstests/noPassthrough/geo_full.js @@ -395,7 +395,6 @@ for (var test = 0; test < numTests; test++) { delete env.earth; assert.commandWorked(t.createIndex(indexDoc, env)); - assert.isnull(db.getLastError()); var padding = "x"; for (var i = 0; i < paddingSize; i++) diff --git a/jstests/noPassthrough/indexbg1.js b/jstests/noPassthrough/indexbg1.js index 24b93699399..ed8ebc41828 100644 --- a/jstests/noPassthrough/indexbg1.js +++ b/jstests/noPassthrough/indexbg1.js @@ -123,10 +123,7 @@ assert.eq(1, t.count({i: -50})); assert.eq(1, t.count({i: size + 2})); assert.eq(0, t.count({i: 40})); print("about to drop index"); -t.dropIndex({i: 1}); -var gle = db.getLastError(); -printjson(gle); -assert(!gle); +assert.commandWorked(t.dropIndex({i: 1})); MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthrough/update_server-5552.js b/jstests/noPassthrough/update_server-5552.js index 4af4491b999..5eeea743c6c 100644 --- a/jstests/noPassthrough/update_server-5552.js +++ b/jstests/noPassthrough/update_server-5552.js @@ -19,16 +19,15 @@ assert.commandWorked(bulk.execute()); const join = startParallelShell( "while( db.foo.findOne( { _id : 0 } ).x == 1 ); db.foo.createIndex( { x : 1 } );"); -t.update({ +assert.commandWorked(t.update({ $where: function() { sleep(1); return true; } }, - {$set: {x: 5}}, - false, - true); -db.getLastError(); + {$set: {x: 5}}, + false, + true)); join(); diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js index bd2808017a5..27bdedc44e3 100644 --- a/jstests/sharding/read_pref_cmd.js +++ b/jstests/sharding/read_pref_cmd.js @@ -307,9 +307,11 @@ let testConnReadPreference = function(conn, isMongos, rsNodes, {readPref, expect cmdTest( {dbStats: 1}, allowedOnSecondary.kAlways, true, formatProfileQuery(kDbName, {dbStats: 1})); - assert.commandWorked(shardedColl.createIndex({loc: '2d'})); - - assert.commandWorked(testDB.runCommand({getLastError: 1, w: nodeCount})); + assert.commandWorked(testDB.runCommand({ + createIndexes: shardedColl.getName(), + indexes: [{key: {loc: '2d'}, name: '2d'}], + writeConcern: {w: nodeCount} + })); // Test on sharded cmdTest({aggregate: kShardedCollName, pipeline: [{$project: {x: 1}}], cursor: {}}, diff --git a/jstests/sharding/rename.js b/jstests/sharding/rename.js index b8d049bbf7c..d59143dae23 100644 --- a/jstests/sharding/rename.js +++ b/jstests/sharding/rename.js @@ -10,15 +10,13 @@ var s = new ShardingTest({shards: 2, mongos: 1, rs: {oplogSize: 10}}); var db = s.getDB("test"); assert.commandWorked(db.foo.insert({_id: 1})); -db.foo.renameCollection('bar'); -assert.isnull(db.getLastError(), '1.0'); +assert.commandWorked(db.foo.renameCollection('bar')); assert.eq(db.bar.findOne(), {_id: 1}, '1.1'); assert.eq(db.bar.count(), 1, '1.2'); assert.eq(db.foo.count(), 0, '1.3'); assert.commandWorked(db.foo.insert({_id: 2})); -db.foo.renameCollection('bar', true); -assert.isnull(db.getLastError(), '2.0'); +assert.commandWorked(db.foo.renameCollection('bar', true)); assert.eq(db.bar.findOne(), {_id: 2}, '2.1'); assert.eq(db.bar.count(), 1, '2.2'); assert.eq(db.foo.count(), 0, '2.3'); |