diff --git a/tests/metrics/verifyMongoDBCollectionFlags_test.js b/tests/metrics/verifyMongoDBCollectionFlags_test.js index e0c8f65c9..29e417330 100644 --- a/tests/metrics/verifyMongoDBCollectionFlags_test.js +++ b/tests/metrics/verifyMongoDBCollectionFlags_test.js @@ -291,8 +291,8 @@ 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.wait(30); + 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(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' }]); }, 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(