From 3e1dcdc886839afb42f334be23cd3e3b4c3877a3 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Tue, 3 Dec 2024 11:46:20 +0100 Subject: [PATCH 1/6] PMM-12219: Unskip PMM-T1241 --- tests/metrics/verifyMongoDB_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/metrics/verifyMongoDB_test.js b/tests/metrics/verifyMongoDB_test.js index 7a2384af5..22983942f 100644 --- a/tests/metrics/verifyMongoDB_test.js +++ b/tests/metrics/verifyMongoDB_test.js @@ -47,7 +47,7 @@ AfterSuite(async ({ I }) => { await I.mongoDisconnect(); }); -Scenario.skip( +Scenario( 'PMM-T1241 - Verify add mongoDB service with "+" in user password @not-ui-pipeline @mongodb-exporter', async ({ I, grafanaAPI }) => { await I.say( From 646a96dc74dd95708bfcd69afc7ab58de4b4eea2 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Tue, 3 Dec 2024 13:13:13 +0100 Subject: [PATCH 2/6] PMM-12219: Fix port --- tests/metrics/verifyMongoDB_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/metrics/verifyMongoDB_test.js b/tests/metrics/verifyMongoDB_test.js index 22983942f..d9b7154a4 100644 --- a/tests/metrics/verifyMongoDB_test.js +++ b/tests/metrics/verifyMongoDB_test.js @@ -51,7 +51,7 @@ Scenario( 'PMM-T1241 - Verify add mongoDB service with "+" in user password @not-ui-pipeline @mongodb-exporter', async ({ I, grafanaAPI }) => { await I.say( - await I.verifyCommand(`pmm-admin add mongodb --port=${connection.port} --password=${mongo_test_user.password} --username='${mongo_test_user.username}' --service-name=${mongodb_service_name}`), + await I.verifyCommand(`pmm-admin add mongodb --port=27017 --password=${mongo_test_user.password} --username='${mongo_test_user.username}' --service-name=${mongodb_service_name}`), ); await grafanaAPI.waitForMetric('mongodb_up', { type: 'service_name', value: mongodb_service_name }, 65); From b6d3620680c3085af0b0e150a121d515cb13636e Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Tue, 3 Dec 2024 14:03:51 +0100 Subject: [PATCH 3/6] PMM-12219: create user --- tests/metrics/verifyMongoDB_test.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/metrics/verifyMongoDB_test.js b/tests/metrics/verifyMongoDB_test.js index d9b7154a4..0ccfe4bc7 100644 --- a/tests/metrics/verifyMongoDB_test.js +++ b/tests/metrics/verifyMongoDB_test.js @@ -50,8 +50,25 @@ AfterSuite(async ({ I }) => { Scenario( 'PMM-T1241 - Verify add mongoDB service with "+" in user password @not-ui-pipeline @mongodb-exporter', async ({ I, grafanaAPI }) => { + await I.say(await I.verifyCommand(`docker exer rs101 mongo "mongodb://${connection.username}:${connection.password}@localhost/" << EOF + db.getSiblingDB("admin").createUser({ + user: "test_user", + pwd: "pass+", + roles: [ + { role: "explainRole", db: "admin" }, + { role: "clusterMonitor", db: "admin" }, + { role: "read", db: "local" }, + { "db" : "admin", "role" : "readWrite", "collection": "" }, + { "db" : "admin", "role" : "backup" }, + { "db" : "admin", "role" : "clusterMonitor" }, + { "db" : "admin", "role" : "restore" }, + { "db" : "admin", "role" : "pbmAnyAction" } + ] + }); + EOF`)); + await I.say( - await I.verifyCommand(`pmm-admin add mongodb --port=27017 --password=${mongo_test_user.password} --username='${mongo_test_user.username}' --service-name=${mongodb_service_name}`), + await I.verifyCommand(`pmm-admin add mongodb --port=${connection.port} --password=${mongo_test_user.password} --username='${mongo_test_user.username}' --service-name=${mongodb_service_name}`), ); await grafanaAPI.waitForMetric('mongodb_up', { type: 'service_name', value: mongodb_service_name }, 65); From f4fdcd632c35d56b4efaf52403118916aa329208 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Tue, 3 Dec 2024 18:50:59 +0100 Subject: [PATCH 4/6] PMM-12219: create user --- tests/metrics/verifyMongoDB_test.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/tests/metrics/verifyMongoDB_test.js b/tests/metrics/verifyMongoDB_test.js index 0ccfe4bc7..b22106dbc 100644 --- a/tests/metrics/verifyMongoDB_test.js +++ b/tests/metrics/verifyMongoDB_test.js @@ -51,20 +51,7 @@ Scenario( 'PMM-T1241 - Verify add mongoDB service with "+" in user password @not-ui-pipeline @mongodb-exporter', async ({ I, grafanaAPI }) => { await I.say(await I.verifyCommand(`docker exer rs101 mongo "mongodb://${connection.username}:${connection.password}@localhost/" << EOF - db.getSiblingDB("admin").createUser({ - user: "test_user", - pwd: "pass+", - roles: [ - { role: "explainRole", db: "admin" }, - { role: "clusterMonitor", db: "admin" }, - { role: "read", db: "local" }, - { "db" : "admin", "role" : "readWrite", "collection": "" }, - { "db" : "admin", "role" : "backup" }, - { "db" : "admin", "role" : "clusterMonitor" }, - { "db" : "admin", "role" : "restore" }, - { "db" : "admin", "role" : "pbmAnyAction" } - ] - }); + db.getSiblingDB("admin").createUser({user: "test_user", pwd: "pass+", roles: [{ role: "explainRole", db: "admin" }, { role: "clusterMonitor", db: "admin" }, { role: "read", db: "local" }, { "db" : "admin", "role" : "readWrite", "collection": "" }, { "db" : "admin", "role" : "backup" }, { "db" : "admin", "role" : "clusterMonitor" }, { "db" : "admin", "role" : "restore" }, { "db" : "admin", "role" : "pbmAnyAction" }]}); EOF`)); await I.say( From 32dcd03107a57480929b3a5ee6a01af445f2b6b5 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Wed, 4 Dec 2024 07:47:47 +0100 Subject: [PATCH 5/6] PMM-12219: create user --- tests/metrics/verifyMongoDB_test.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/metrics/verifyMongoDB_test.js b/tests/metrics/verifyMongoDB_test.js index b22106dbc..742f1ebeb 100644 --- a/tests/metrics/verifyMongoDB_test.js +++ b/tests/metrics/verifyMongoDB_test.js @@ -27,7 +27,16 @@ const telemetry = { BeforeSuite(async ({ I }) => { await I.mongoConnect(connection); - await I.mongoAddUser(mongo_test_user.username, mongo_test_user.password); + await I.mongoAddUser(mongo_test_user.username, mongo_test_user.password, [ + { role: 'explainRole', db: 'admin' }, + { role: 'clusterMonitor', db: 'admin' }, + { role: 'read', db: 'local' }, + { db: 'admin', role: 'readWrite', collection: '' }, + { db: 'admin', role: 'backup' }, + { db: 'admin', role: 'clusterMonitor' }, + { db: 'admin', role: 'restore' }, + { db: 'admin', role: 'pbmAnyAction' }, + ]); // check that rs101 docker container exists const dockerCheck = await I.verifyCommand('docker ps | grep rs101'); @@ -50,12 +59,12 @@ AfterSuite(async ({ I }) => { Scenario( 'PMM-T1241 - Verify add mongoDB service with "+" in user password @not-ui-pipeline @mongodb-exporter', async ({ I, grafanaAPI }) => { - await I.say(await I.verifyCommand(`docker exer rs101 mongo "mongodb://${connection.username}:${connection.password}@localhost/" << EOF - db.getSiblingDB("admin").createUser({user: "test_user", pwd: "pass+", roles: [{ role: "explainRole", db: "admin" }, { role: "clusterMonitor", db: "admin" }, { role: "read", db: "local" }, { "db" : "admin", "role" : "readWrite", "collection": "" }, { "db" : "admin", "role" : "backup" }, { "db" : "admin", "role" : "clusterMonitor" }, { "db" : "admin", "role" : "restore" }, { "db" : "admin", "role" : "pbmAnyAction" }]}); - EOF`)); + // await I.say(await I.verifyCommand(`docker exer rs101 mongo "mongodb://${connection.username}:${connection.password}@localhost/" << EOF + // db.getSiblingDB("admin").createUser({user: "test_user", pwd: "pass+", roles: [{ role: "explainRole", db: "admin" }, { role: "clusterMonitor", db: "admin" }, { role: "read", db: "local" }, { "db" : "admin", "role" : "readWrite", "collection": "" }, { "db" : "admin", "role" : "backup" }, { "db" : "admin", "role" : "clusterMonitor" }, { "db" : "admin", "role" : "restore" }, { "db" : "admin", "role" : "pbmAnyAction" }]}); + // EOF`)); await I.say( - await I.verifyCommand(`pmm-admin add mongodb --port=${connection.port} --password=${mongo_test_user.password} --username='${mongo_test_user.username}' --service-name=${mongodb_service_name}`), + await I.verifyCommand(`pmm-admin add mongodb --port=${connection.port} --password="${mongo_test_user.password}" --username="${mongo_test_user.username}" --service-name=${mongodb_service_name}`), ); await grafanaAPI.waitForMetric('mongodb_up', { type: 'service_name', value: mongodb_service_name }, 65); From 5b6e4668ab65a930375dd81ebdd15abfa5815188 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Wed, 4 Dec 2024 08:05:11 +0100 Subject: [PATCH 6/6] PMM-12219: create user --- tests/metrics/verifyMongoDB_test.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/metrics/verifyMongoDB_test.js b/tests/metrics/verifyMongoDB_test.js index 742f1ebeb..ec5de6b81 100644 --- a/tests/metrics/verifyMongoDB_test.js +++ b/tests/metrics/verifyMongoDB_test.js @@ -59,10 +59,6 @@ AfterSuite(async ({ I }) => { Scenario( 'PMM-T1241 - Verify add mongoDB service with "+" in user password @not-ui-pipeline @mongodb-exporter', async ({ I, grafanaAPI }) => { - // await I.say(await I.verifyCommand(`docker exer rs101 mongo "mongodb://${connection.username}:${connection.password}@localhost/" << EOF - // db.getSiblingDB("admin").createUser({user: "test_user", pwd: "pass+", roles: [{ role: "explainRole", db: "admin" }, { role: "clusterMonitor", db: "admin" }, { role: "read", db: "local" }, { "db" : "admin", "role" : "readWrite", "collection": "" }, { "db" : "admin", "role" : "backup" }, { "db" : "admin", "role" : "clusterMonitor" }, { "db" : "admin", "role" : "restore" }, { "db" : "admin", "role" : "pbmAnyAction" }]}); - // EOF`)); - await I.say( await I.verifyCommand(`pmm-admin add mongodb --port=${connection.port} --password="${mongo_test_user.password}" --username="${mongo_test_user.username}" --service-name=${mongodb_service_name}`), );