From 8fdd8568c58310cbb1d4e177d95ec63955f6c1aa Mon Sep 17 00:00:00 2001 From: Jamie Anderson Date: Fri, 30 Apr 2021 17:06:53 +0000 Subject: SERVER-29438 Combine max_time_ms_sharded_new_commands.js with max_time_ms_sharded.js --- jstests/noPassthrough/max_time_ms_sharded.js | 18 ++++++++++ .../sharding/max_time_ms_sharded_new_commands.js | 41 ---------------------- 2 files changed, 18 insertions(+), 41 deletions(-) delete mode 100644 jstests/sharding/max_time_ms_sharded_new_commands.js diff --git a/jstests/noPassthrough/max_time_ms_sharded.js b/jstests/noPassthrough/max_time_ms_sharded.js index 676651523bd..a0a34762874 100644 --- a/jstests/noPassthrough/max_time_ms_sharded.js +++ b/jstests/noPassthrough/max_time_ms_sharded.js @@ -215,6 +215,24 @@ configureMaxTimeAlwaysTimeOut("off"); assert.commandWorked(coll.runCommand("aggregate", {pipeline: [], cursor: {}, maxTimeMS: 60 * 1000}), "expected aggregate to not hit time limit in mongod"); +// Positive test for "setFeatureCompatibilityVersion" +configureMaxTimeAlwaysTimeOut("alwaysOn"); +assert.commandFailedWithCode( + admin.runCommand({setFeatureCompatibilityVersion: lastLTSFCV, maxTimeMS: 1000 * 60 * 60 * 24}), + ErrorCodes.MaxTimeMSExpired, + "expected setFeatureCompatibilityVersion to fail due to maxTimeAlwaysTimeOut fail point"); + +// Negative test for "setFeatureCompatibilityVersion" +configureMaxTimeAlwaysTimeOut("off"); +assert.commandWorked( + admin.runCommand({setFeatureCompatibilityVersion: lastLTSFCV, maxTimeMS: 1000 * 60 * 60 * 24}), + "expected setFeatureCompatibilityVersion to not hit time limit in mongod"); + +// Negative test for "setFeatureCompatibilityVersion" to upgrade +assert.commandWorked( + admin.runCommand({setFeatureCompatibilityVersion: latestFCV, maxTimeMS: 1000 * 60 * 60 * 24}), + "expected setFeatureCompatibilityVersion to not hit time limit in mongod"); + // Test that the maxTimeMS is still enforced on the shards even if we do not spend much time in // mongos blocking. diff --git a/jstests/sharding/max_time_ms_sharded_new_commands.js b/jstests/sharding/max_time_ms_sharded_new_commands.js deleted file mode 100644 index 28046963b75..00000000000 --- a/jstests/sharding/max_time_ms_sharded_new_commands.js +++ /dev/null @@ -1,41 +0,0 @@ -// Make sure the setFeatureCompatibilityVersion command respects maxTimeMs. -// @tags: [multiversion_incompatible] -(function() { -'use strict'; - -var st = new ShardingTest({shards: 2}); - -var mongos = st.s0; -var shards = [st.shard0, st.shard1]; -var admin = mongos.getDB("admin"); - -// Helper function to configure "maxTimeAlwaysTimeOut" fail point on shards, which forces mongod -// to throw if it receives an operation with a max time. See fail point declaration for -// complete description. -var configureMaxTimeAlwaysTimeOut = function(mode) { - assert.commandWorked(shards[0].getDB("admin").runCommand( - {configureFailPoint: "maxTimeAlwaysTimeOut", mode: mode})); - assert.commandWorked(shards[1].getDB("admin").runCommand( - {configureFailPoint: "maxTimeAlwaysTimeOut", mode: mode})); -}; - -jsTestLog("Positive test for setFeatureCompatibilityVersion"); -configureMaxTimeAlwaysTimeOut("alwaysOn"); -assert.commandFailedWithCode( - admin.runCommand({setFeatureCompatibilityVersion: lastLTSFCV, maxTimeMS: 1000 * 60 * 60 * 24}), - ErrorCodes.MaxTimeMSExpired, - "expected setFeatureCompatibilityVersion to fail due to maxTimeAlwaysTimeOut fail point"); - -jsTestLog("Negative test for setFeatureCompatibilityVersion to downgrade"); -configureMaxTimeAlwaysTimeOut("off"); -assert.commandWorked( - admin.runCommand({setFeatureCompatibilityVersion: lastLTSFCV, maxTimeMS: 1000 * 60 * 60 * 24}), - "expected setFeatureCompatibilityVersion to not hit time limit in mongod"); - -jsTestLog("Negative test for setFeatureCompatibilityVersion to upgrade"); -assert.commandWorked( - admin.runCommand({setFeatureCompatibilityVersion: latestFCV, maxTimeMS: 1000 * 60 * 60 * 24}), - "expected setFeatureCompatibilityVersion to not hit time limit in mongod"); - -st.stop(); -})(); -- cgit v1.2.1