SERVER-84547 Fix tests (#43449)

GitOrigin-RevId: c0dcc97b1348bdd99bb685c5adae6e989c0f176d
This commit is contained in:
karlbozdogan
2025-11-03 19:06:01 +01:00
committed by MongoDB Bot
parent 719b686099
commit 4b911a0c25
3 changed files with 21 additions and 8 deletions

2
.github/CODEOWNERS vendored
View File

@@ -401,7 +401,7 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
/jstests/**/*move*primary* @10gen/server-catalog-and-routing-ddl @svc-auto-approve-bot
/jstests/**/*refine_collection_shard_key* @10gen/server-catalog-and-routing-ddl @svc-auto-approve-bot
/jstests/**/*dbcheck* @10gen/server-dbcheck @svc-auto-approve-bot
/jstests/**/*query* @10gen/query-execution @svc-auto-approve-bot
/jstests/**/*query* @10gen/query @svc-auto-approve-bot
# The following patterns are parsed from ./jstests/aggregation/OWNERS.yml
/jstests/aggregation/**/* @10gen/query @svc-auto-approve-bot

View File

@@ -38,4 +38,4 @@ filters:
- 10gen/server-dbcheck
- "**/*query*":
approvers:
- 10gen/query-execution
- 10gen/query

View File

@@ -1,7 +1,15 @@
//
// Tests that only one shard is targeted for trivially empty queries.
// @tags: [requires_fcv_83, requires_2_or_more_shards]
//
/**
* Tests that only one shard is targeted for trivially empty queries.
* @tags: [
* requires_fcv_83,
* requires_2_or_more_shards,
* # Avoid implicitly sharding the test collection.
* assumes_no_implicit_collection_creation_on_get_collection,
* # "Refusing to run a test that issues an aggregation command with
* # explain because it may return incomplete results if interrupted by a stepdown."
* does_not_support_stepdowns,
* ]
*/
import {getShards} from "jstests/sharding/libs/sharding_util.js";
@@ -21,8 +29,13 @@ let shardName1 = shard1._id;
coll.drop();
assert.commandWorked(db.adminCommand({shardCollection: ns, key: {"_id": 1}}));
assert.commandWorked(db.adminCommand({moveRange: ns, min: {_id: 0}, max: {_id: 5}, toShard: shardName0}));
assert.commandWorked(db.adminCommand({moveRange: ns, min: {_id: 5}, max: {_id: 10}, toShard: shardName1}));
// These commands sometimes conflict with the balancer,
// so we retry on ConflictingOperationInProgress errors.
assert.soonRetryOnAcceptableErrors(() => {
assert.commandWorked(db.adminCommand({moveRange: ns, min: {_id: 0}, max: {_id: 5}, toShard: shardName0}));
assert.commandWorked(db.adminCommand({moveRange: ns, min: {_id: 5}, max: {_id: 10}, toShard: shardName1}));
return true;
}, ErrorCodes.ConflictingOperationInProgress);
const res1 = coll.explain().aggregate([{$match: {$expr: false}}]);
assert.eq(Object.keys(res1.shards).length, 1);