mirror of https://github.com/mongodb/mongo
SERVER-109603 Add test cases for direct connection DDLs on replicaset (#40655)
GitOrigin-RevId: c280215653a9c5fa51c890689869e7710dfa03a1
This commit is contained in:
parent
67d990749e
commit
66c68fd354
|
|
@ -1489,6 +1489,7 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
|
|||
/jstests/sharding/**/commit_shard_removal_test.js @10gen/server-catalog-and-routing @svc-auto-approve-bot
|
||||
/jstests/sharding/**/validate_collection*.js @10gen/server-catalog-and-routing @svc-auto-approve-bot
|
||||
/jstests/sharding/**/add_and_remove_shard_serializes_with_ddl.js @10gen/server-catalog-and-routing @svc-auto-approve-bot
|
||||
/jstests/sharding/**/direct_shard_connection_ddls_on_replicaset.js @10gen/server-catalog-and-routing @svc-auto-approve-bot
|
||||
|
||||
# The following patterns are parsed from ./jstests/sharding/analyze_shard_key/OWNERS.yml
|
||||
/jstests/sharding/analyze_shard_key/**/* @10gen/server-cluster-scalability @svc-auto-approve-bot
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ selector:
|
|||
- jstests/sharding/internal_txns/internal_client_restrictions.js
|
||||
- jstests/sharding/kill_sessions.js
|
||||
- jstests/sharding/replica_set_promotion_demotion.js
|
||||
- jstests/sharding/direct_shard_connection_ddls_on_replicaset.js
|
||||
- jstests/sharding/parallel.js
|
||||
- jstests/sharding/migration_ignore_interrupts_1.js
|
||||
- jstests/sharding/migration_ignore_interrupts_2.js
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ selector:
|
|||
- jstests/sharding/internal_txns/internal_client_restrictions.js
|
||||
- jstests/sharding/kill_sessions.js
|
||||
- jstests/sharding/replica_set_promotion_demotion.js
|
||||
- jstests/sharding/direct_shard_connection_ddls_on_replicaset.js
|
||||
# Skip these additional tests when running with auth enabled.
|
||||
- jstests/sharding/parallel.js
|
||||
# Skip the testcases that do not have auth bypass when running ops in parallel.
|
||||
|
|
|
|||
|
|
@ -85,3 +85,6 @@ filters:
|
|||
- "add_and_remove_shard_serializes_with_ddl.js":
|
||||
approvers:
|
||||
- 10gen/server-catalog-and-routing
|
||||
- "direct_shard_connection_ddls_on_replicaset.js":
|
||||
approvers:
|
||||
- 10gen/server-catalog-and-routing
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* Testing direct shard connection DDLs towards a replica set with different startup options are allowed with no special permissions
|
||||
* @tags: [
|
||||
* # The test caches authenticated connections, so we do not support stepdowns
|
||||
* does_not_support_stepdowns,
|
||||
* featureFlagPreventDirectShardDDLsDuringPromotion
|
||||
* ]
|
||||
*/
|
||||
|
||||
import {afterEach, before, beforeEach, describe, it} from "jstests/libs/mochalite.js";
|
||||
import {ReplSetTest} from "jstests/libs/replsettest.js";
|
||||
|
||||
describe("Check direct DDLs against replica set with different startup option are allowed without special permissions", function () {
|
||||
before(function () {
|
||||
this.createNewUserForDBAndGetDirectConn = function (user, pwd, roles, db) {
|
||||
this.rs.getPrimary().getDB(db).createUser({user: user, pwd: pwd, roles: roles});
|
||||
const userDirectConnection = new Mongo(this.rs.getPrimary().host);
|
||||
const testDBDirectConnection = userDirectConnection.getDB(db);
|
||||
assert(testDBDirectConnection.auth(user, pwd), "Authentication failed!");
|
||||
return testDBDirectConnection;
|
||||
};
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
this.rs = new ReplSetTest({name: "rs", nodes: 3});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
this.rs.stopSet();
|
||||
});
|
||||
|
||||
it("Node started with no options", () => {
|
||||
this.rs.startSet();
|
||||
this.rs.initiate();
|
||||
const testDBDirectConnection = this.createNewUserForDBAndGetDirectConn("user", "x", ["readWrite"], "testDB");
|
||||
assert.commandWorked(testDBDirectConnection.createCollection("testColl0"));
|
||||
});
|
||||
|
||||
it("Node started with --shardsvr", () => {
|
||||
this.rs.startSet({shardsvr: ""});
|
||||
this.rs.initiate();
|
||||
const testDBDirectConnection = this.createNewUserForDBAndGetDirectConn("user", "x", ["readWrite"], "testDB");
|
||||
assert.commandWorked(testDBDirectConnection.createCollection("testColl1"));
|
||||
});
|
||||
|
||||
it("Node started with --configsvr and --replicaSetConfigShardMaintenanceMode", () => {
|
||||
this.rs.startSet({configsvr: "", replicaSetConfigShardMaintenanceMode: ""});
|
||||
this.rs.initiate();
|
||||
const testDBDirectConnection = this.createNewUserForDBAndGetDirectConn("user", "x", ["readWrite"], "testDB");
|
||||
assert.commandWorked(testDBDirectConnection.createCollection("testColl2"));
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue