0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 00:17:37 +01:00
mongodb/jstests/sharding/move_primary_fails_without_database_version.js
Matt Broadstone 771dabd098 SERVER-81339 Convert ReplSetTest and ShardingTest to modules (#26332)
GitOrigin-RevId: 744aa110a53786b23c62ff53f87a1418b5991e8d
2024-08-20 22:00:49 +00:00

21 lines
652 B
JavaScript

// Tests that a movePrimary will fail if the database doesn't have a version in config.databases.
import {ShardingTest} from "jstests/libs/shardingtest.js";
// Do not check metadata consistency as the database version is missing for testing purposes.
TestData.skipCheckMetadataConsistency = true;
TestData.skipCheckRoutingTableConsistency = true;
const dbName = "test";
const st = new ShardingTest({shards: 2});
assert.commandWorked(st.s.getDB("config").getCollection("databases").insert({
_id: dbName,
primary: st.shard0.shardName
}));
assert.commandFailed(st.s.adminCommand({movePrimary: dbName, to: st.shard1.shardName}));
st.stop();