mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-27 23:27:11 +01:00
771dabd098
GitOrigin-RevId: 744aa110a53786b23c62ff53f87a1418b5991e8d
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
// Tests that the $currentOp works as expected when run with the targetAllNodes option turned on and
|
|
// off.
|
|
//
|
|
// @tags: [
|
|
// requires_fcv_71,
|
|
// ]
|
|
import {ShardingTest} from "jstests/libs/shardingtest.js";
|
|
|
|
const shardCount = 2;
|
|
const rsNodesPerShardCount = 2;
|
|
const st = new ShardingTest({shards: shardCount, rs: {nodes: rsNodesPerShardCount}});
|
|
const clusterAdminDB = st.s.getDB("admin");
|
|
|
|
function runCurrentOpAgg(shouldTargetAllNodes) {
|
|
return clusterAdminDB.aggregate(
|
|
[
|
|
{$currentOp: {targetAllNodes: shouldTargetAllNodes}},
|
|
{$match: {"command.comment": "issuing a currentOp with targetAllNodes"}}
|
|
],
|
|
{comment: "issuing a currentOp with targetAllNodes"});
|
|
}
|
|
|
|
const targetAllNodesFalse = runCurrentOpAgg(false);
|
|
assert.eq(shardCount, targetAllNodesFalse.itcount(), tojson(targetAllNodesFalse));
|
|
|
|
const targetAllNodesTrue = runCurrentOpAgg(true);
|
|
assert.eq(
|
|
shardCount * rsNodesPerShardCount, targetAllNodesTrue.itcount(), tojson(targetAllNodesTrue));
|
|
|
|
st.stop(); |