summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/concurrency/fsm_workloads/analyze_shard_key.js6
-rw-r--r--jstests/sharding/analyze_shard_key/configure_query_analyzer_persistence.js13
2 files changed, 7 insertions, 12 deletions
diff --git a/jstests/concurrency/fsm_workloads/analyze_shard_key.js b/jstests/concurrency/fsm_workloads/analyze_shard_key.js
index dc6fa75d296..6e092338790 100644
--- a/jstests/concurrency/fsm_workloads/analyze_shard_key.js
+++ b/jstests/concurrency/fsm_workloads/analyze_shard_key.js
@@ -868,11 +868,7 @@ var $config = extendWorkload($config, function($config, $super) {
$config.states.disableQuerySampling = function disableQuerySampling(db, collName) {
print("Starting disableQuerySampling state");
const ns = db.getName() + "." + collName;
- // If query sampling is off, this command is expected to fail with an IllegalOperation
- // error.
- assert.commandWorkedOrFailedWithCode(
- db.adminCommand({configureQueryAnalyzer: ns, mode: "off"}),
- ErrorCodes.IllegalOperation);
+ assert.commandWorked(db.adminCommand({configureQueryAnalyzer: ns, mode: "off"}));
print("Finished disableQuerySampling state");
};
diff --git a/jstests/sharding/analyze_shard_key/configure_query_analyzer_persistence.js b/jstests/sharding/analyze_shard_key/configure_query_analyzer_persistence.js
index 6ba1108021a..aba1408b8d1 100644
--- a/jstests/sharding/analyze_shard_key/configure_query_analyzer_persistence.js
+++ b/jstests/sharding/analyze_shard_key/configure_query_analyzer_persistence.js
@@ -73,10 +73,10 @@ function testPersistingConfiguration(conn) {
tojson({dbName, collName, collUuid})}`);
// Run a configureQueryAnalyzer command to disable query sampling. Verify that the command
- // fails since query sampling is not even active.
+ // does not fail although query sampling is not even active.
const mode0 = "off";
- assert.commandFailedWithCode(conn.adminCommand({configureQueryAnalyzer: ns, mode: mode0}),
- ErrorCodes.IllegalOperation);
+ const res0 = assert.commandWorked(conn.adminCommand({configureQueryAnalyzer: ns, mode: mode0}));
+ assertConfigQueryAnalyzerResponse(res0, {mode: mode0} /* newConfig */);
assertNoQueryAnalyzerConfigDoc(conn, ns);
// Run a configureQueryAnalyzer command to enable query sampling.
@@ -151,10 +151,9 @@ function testPersistingConfiguration(conn) {
{mode: mode6} /* newConfig */,
{mode: mode5, sampleRate: sampleRate5} /* oldConfig */);
- // Retry the previous configureQueryAnalyzer command. Verify that the 'stopTime' remains the
- // same.
- assert.commandFailedWithCode(conn.adminCommand({configureQueryAnalyzer: ns, mode: mode6}),
- ErrorCodes.IllegalOperation);
+ // Retry the previous configureQueryAnalyzer command. Verify that the retry does not fail and
+ // that the 'stopTime' remains the same.
+ assert.commandWorked(conn.adminCommand({configureQueryAnalyzer: ns, mode: mode6}));
assertQueryAnalyzerConfigDoc(
conn, ns, collUuid, mode6, sampleRate5, doc5.startTime, doc6.stopTime);
}