From 91f54cc887710ccc6e91c96d82274a66c811b8c9 Mon Sep 17 00:00:00 2001 From: Rui Liu Date: Tue, 4 Jan 2022 11:44:51 +0000 Subject: SERVER-62319 Allow different errors thrown by different collMod implementation --- jstests/core/hidden_index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jstests/core/hidden_index.js b/jstests/core/hidden_index.js index 838d99fb71c..2a2658da116 100644 --- a/jstests/core/hidden_index.js +++ b/jstests/core/hidden_index.js @@ -98,9 +98,10 @@ assert.eq(idxSpec.hidden, true); // Can't hide any index in a system collection. const systemColl = db.getSiblingDB('admin').system.version; assert.commandWorked(systemColl.createIndex({a: 1})); -assert.commandFailedWithCode( - systemColl.hideIndex("a_1"), - FixtureHelpers.isMongos(db) ? ErrorCodes.NoShardingEnabled : ErrorCodes.BadValue); +// The collMod command throws NoShardingEnabled on DDL coordinator implementation and BadValue on +// old implementation. +assert.commandFailedWithCode(systemColl.hideIndex("a_1"), + [ErrorCodes.NoShardingEnabled, ErrorCodes.BadValue]); assert.commandFailedWithCode(systemColl.createIndex({a: 1}, {hidden: true}), 2); // Can't hide the '_id' index. -- cgit v1.2.1