DBZ-7221 sharded mongo tests - fixed deployments when internal auth isn't used, removed unnecessary permissions for debezium user
This commit is contained in:
parent
26004d67a5
commit
ec90242567
@ -109,7 +109,7 @@
|
||||
<database.mongo.docker.replica.size>1</database.mongo.docker.replica.size>
|
||||
|
||||
<!--Mongodb sharded configuration-->
|
||||
<database.mongo.sharded.enable.internal.auth>true</database.mongo.sharded.enable.internal.auth>
|
||||
<database.mongo.use.keyfile>true</database.mongo.use.keyfile>
|
||||
|
||||
|
||||
<!--DB2 configuration -->
|
||||
@ -561,7 +561,7 @@
|
||||
<test.database.mongo.docker.replica.size>${database.mongo.docker.replica.size}</test.database.mongo.docker.replica.size>
|
||||
|
||||
<!--Mongo sharded configuration-->
|
||||
<test.database.mongo.sharded.enable.internal.auth>${database.mongo.sharded.enable.internal.auth}</test.database.mongo.sharded.enable.internal.auth>
|
||||
<test.database.mongo.use.keyfile>${database.mongo.use.keyfile}</test.database.mongo.use.keyfile>
|
||||
|
||||
<!--DB2 configuration-->
|
||||
<test.database.db2.host>${database.db2.host}</test.database.db2.host>
|
||||
|
@ -101,7 +101,7 @@ private ConfigProperties() {
|
||||
public static final String DATABASE_MONGO_DBZ_LOGIN_DBNAME = System.getProperty("test.database.mongo.dbz.login.dbname", "admin");
|
||||
public static final Optional<String> DATABASE_MONGO_HOST = stringOptionalProperty("test.database.mongo.host");
|
||||
public static final int DATABASE_MONGO_PORT = Integer.parseInt(System.getProperty("test.database.mongo.port", "27017"));
|
||||
public static final boolean DATABASE_MONGO_ENABLE_INTERNAL_AUTH = Boolean.parseBoolean(System.getProperty("test.database.mongo.sharded.enable.internal.auth"));
|
||||
public static final boolean DATABASE_MONGO_USE_KEYFILE = Boolean.parseBoolean(System.getProperty("test.database.mongo.use.keyfile"));
|
||||
|
||||
public static final String DATABASE_MONGO_DOCKER_DESKTOP_PORTS = System.getProperty("database.mongo.docker.desktop.ports", "27017:27117");
|
||||
public static final int DATABASE_MONGO_DOCKER_REPLICA_SIZE = Integer.parseInt(System.getProperty("database.mongo.docker.replica.size", "1"));
|
||||
|
@ -41,8 +41,6 @@ public void start() {
|
||||
@Override
|
||||
public void stop() {
|
||||
ocpUtils.scaleDeploymentToZero(deployment);
|
||||
// ocp.apps().deployments().inNamespace(project).delete(deployment);
|
||||
// ocp.services().inNamespace(project).delete(service);
|
||||
}
|
||||
|
||||
public void waitForStopped() {
|
||||
|
@ -83,7 +83,6 @@ public static Deployment configServerDeployment(int num) {
|
||||
.withImage(ConfigProperties.DOCKER_IMAGE_MONGO_SHARDED)
|
||||
.withCommand("mongod",
|
||||
"--configsvr",
|
||||
"--auth",
|
||||
"--replSet",
|
||||
OcpMongoShardedConstants.MONGO_CONFIG_REPLICASET_NAME,
|
||||
"--dbpath",
|
||||
|
@ -82,7 +82,6 @@ public static Deployment shardDeployment(int shardNum, int replicaNum) {
|
||||
.withImage(ConfigProperties.DOCKER_IMAGE_MONGO_SHARDED)
|
||||
.withCommand("mongod",
|
||||
"--shardsvr",
|
||||
"--auth",
|
||||
"--replSet",
|
||||
getShardReplicaSetName(shardNum),
|
||||
"--dbpath",
|
||||
|
@ -35,7 +35,7 @@ protected OcpMongoShardedController databaseController() throws Exception {
|
||||
.withShardCount(OcpMongoShardedConstants.SHARD_COUNT)
|
||||
.withReplicaCount(OcpMongoShardedConstants.REPLICAS_IN_SHARD)
|
||||
.withShardKeys(getTestShardKeys())
|
||||
.withUseInternalAuth(ConfigProperties.DATABASE_MONGO_ENABLE_INTERNAL_AUTH)
|
||||
.withUseInternalAuth(ConfigProperties.DATABASE_MONGO_USE_KEYFILE)
|
||||
.withRootUser(ConfigProperties.DATABASE_MONGO_USERNAME, ConfigProperties.DATABASE_MONGO_SA_PASSWORD)
|
||||
.build();
|
||||
controller = deployer.deploy();
|
||||
|
@ -23,8 +23,7 @@ db.createUser({
|
||||
{ role: "listDatabases", db: "admin" },
|
||||
{ role: "readChangeStream", db: "admin" },
|
||||
{ role: "readAnyDatabase", db: "admin" },
|
||||
{ role: "readWriteAnyDatabase", db: "admin" },
|
||||
{ role: "read", db: "config" },
|
||||
{role: "read", db: "local"}
|
||||
{ role: "read", db: "config", collection: "shards" },
|
||||
{ role: "read", db: "local"}
|
||||
]
|
||||
});
|
||||
|
@ -3,7 +3,7 @@ rs.initiate({ _id: "${rsId}", configsvr: ${configServer?c}, members: [${members}
|
||||
let isPrimary = false;
|
||||
let count = 0;
|
||||
// wait for primary node election
|
||||
while(isPrimary == false && count < 30) {
|
||||
while(isPrimary == false && count < 60) {
|
||||
const rplStatus = db.adminCommand({ replSetGetStatus : 1 });
|
||||
isPrimary = rplStatus.members[0].stateStr === "PRIMARY";
|
||||
print("is primary result: ", isPrimary);
|
||||
|
Loading…
Reference in New Issue
Block a user