From 306fb65fb1aeeb473a51117e8128baf88bfdd0a2 Mon Sep 17 00:00:00 2001 From: Saikumar Date: Fri, 29 Nov 2024 12:17:45 +0530 Subject: [PATCH 1/3] updates add async wait --- tests/pages/api/grafanaAPI.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/pages/api/grafanaAPI.js b/tests/pages/api/grafanaAPI.js index 40faa1b3f..9d75862cc 100644 --- a/tests/pages/api/grafanaAPI.js +++ b/tests/pages/api/grafanaAPI.js @@ -458,7 +458,13 @@ module.exports = { }, async checkMetricExist(metricName, refineBy) { - const response = await this.getMetric(metricName, refineBy); + let response; + + await I.asyncWaitFor(async () => { + response = await this.getMetric(metricName, refineBy); + + return response.data.data.result.length !== 0; + }, 60); const result = JSON.stringify(response.data.data.result); I.assertTrue( @@ -470,7 +476,14 @@ module.exports = { }, async checkMetricAbsent(metricName, refineBy) { - const response = await this.getMetric(metricName, refineBy); + let response; + + await I.asyncWaitFor(async () => { + response = await this.getMetric(metricName, refineBy); + + return response.data.data.result.length === 0; + }, 60); + const result = JSON.stringify(response.data.data.result); I.assertEqual( From 1c0dfa1fb7362f446d93b3ebe6e308ca3b30afe5 Mon Sep 17 00:00:00 2001 From: Saikumar Date: Fri, 29 Nov 2024 13:34:24 +0530 Subject: [PATCH 2/3] updates --- tests/metrics/verifyMongoDBCollectionFlags_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/metrics/verifyMongoDBCollectionFlags_test.js b/tests/metrics/verifyMongoDBCollectionFlags_test.js index e0c8f65c9..9234c20ba 100644 --- a/tests/metrics/verifyMongoDBCollectionFlags_test.js +++ b/tests/metrics/verifyMongoDBCollectionFlags_test.js @@ -291,7 +291,7 @@ Scenario( await I.say(await I.verifyCommand(`docker exec rs101 pmm-admin remove mongodb ${mongodb_service_name}`)); // Re-add Service with Disable Top metrics, check no smart metrics for Top - await I.say(await I.verifyCommand(`docker exec rs101 pmm-admin add mongodb --port=${connection.port} --agent-password='testing' --password=${pmm_user_mongodb.password} --username=${pmm_user_mongodb.username} --enable-all-collectors --disable-collectors=topmetrics --max-collections-limit=400 --stats-collections=db1,db2.col2 --service-name=${mongodb_service_name} --replication-set=rs0s`)); + await I.say(await I.verifyCommand(`docker exec rs101 pmm-admin add mongodb --port=${connection.port} --agent-password='testing' --password=${pmm_user_mongodb.password} --username=${pmm_user_mongodb.username} --enable-all-collectors --disable-collectors='topmetrics' --max-collections-limit=400 --stats-collections=db1,db2.col2 --service-name=${mongodb_service_name} --replication-set=rs0s`)); await I.wait(30); await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: `${mongodb_service_name}` }, { type: 'collector', value: 'dbstats' }]); await grafanaAPI.checkMetricAbsent(smartMetricName, [{ type: 'service_name', value: `${mongodb_service_name}` }, { type: 'collector', value: 'top' }]); From 98cf7796825d5def8ee78d245acd95ed5bd31a7a Mon Sep 17 00:00:00 2001 From: Saikumar Date: Fri, 29 Nov 2024 13:35:02 +0530 Subject: [PATCH 3/3] updates --- tests/metrics/verifyMongoDBCollectionFlags_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/metrics/verifyMongoDBCollectionFlags_test.js b/tests/metrics/verifyMongoDBCollectionFlags_test.js index 9234c20ba..29e417330 100644 --- a/tests/metrics/verifyMongoDBCollectionFlags_test.js +++ b/tests/metrics/verifyMongoDBCollectionFlags_test.js @@ -292,7 +292,7 @@ Scenario( // Re-add Service with Disable Top metrics, check no smart metrics for Top await I.say(await I.verifyCommand(`docker exec rs101 pmm-admin add mongodb --port=${connection.port} --agent-password='testing' --password=${pmm_user_mongodb.password} --username=${pmm_user_mongodb.username} --enable-all-collectors --disable-collectors='topmetrics' --max-collections-limit=400 --stats-collections=db1,db2.col2 --service-name=${mongodb_service_name} --replication-set=rs0s`)); - await I.wait(30); + await I.wait(60); await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_name', value: `${mongodb_service_name}` }, { type: 'collector', value: 'dbstats' }]); await grafanaAPI.checkMetricAbsent(smartMetricName, [{ type: 'service_name', value: `${mongodb_service_name}` }, { type: 'collector', value: 'top' }]); },