Files
mongo/jstests/sharding/server_status_cluster_parameters.js
Steve McClure 1ffbc6c2e9 SERVER-109432: Autofix JS var usage to favor let (#40637)
GitOrigin-RevId: 9674b7db36a0f3f650d39c1e3fb2ad6ff2141cfb
2025-08-28 19:21:01 +00:00

42 lines
1.3 KiB
JavaScript

/**
* Tests that server status reports only the state of cluster parameters that have been set.
*
* @tags: [
* requires_fcv_80
* ]
*/
import {ShardingTest} from "jstests/libs/shardingtest.js";
let st = new ShardingTest({shards: 1});
function getShardingStats(conn) {
return assert.commandWorked(conn.adminCommand({serverStatus: 1})).sharding;
}
function verifyClusterParametersReported(expected, connTypeName, conn) {
const stats = getShardingStats(conn);
const reported = "clusterParameters" in stats;
assert(
reported === expected,
`Expected cluster parameters to ${
expected ? "" : "not "
} be reported in sharding section by ${connTypeName}: ${tojson(stats)}`,
);
}
function verifyClusterParameterReportedOnAllNodeTypes(expected) {
verifyClusterParametersReported(expected, "mongos", st.s);
verifyClusterParametersReported(expected, "mongod", st.rs0.getPrimary());
verifyClusterParametersReported(expected, "config server", st.configRS.getPrimary());
}
verifyClusterParameterReportedOnAllNodeTypes(false);
assert.commandWorked(st.s.adminCommand({setClusterParameter: {pauseMigrationsDuringMultiUpdates: {enabled: true}}}));
assert.commandWorked(st.s.adminCommand({getClusterParameter: "pauseMigrationsDuringMultiUpdates"}));
verifyClusterParameterReportedOnAllNodeTypes(true);
st.stop();