Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates, fix flaky test, use service_id instead and fix prev merge issue. #899

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions tests/metrics/verifyMongoDBCollectionFlags_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,14 @@ Scenario(
await I.say(await I.verifyCommand(`docker exec ${containerName} 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 ${containerName} pmm-admin add mongodb --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 ${containerName} pmm-admin add mongodb --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`));
I.say('Wait 180 seconds for Metrics being collected for the new service');
const { new_service_id } = await inventoryAPI.apiGetNodeInfoByServiceName(SERVICE_TYPE.MONGODB, mongodb_service_name);
const { service_id: new_service_id } = await inventoryAPI
.apiGetNodeInfoByServiceName(SERVICE_TYPE.MONGODB, mongodb_service_name);

await I.wait(180);
await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: `${new_service_id}` }, { type: 'collector', value: 'dbstats' }]);
await grafanaAPI.checkMetricAbsent(smartMetricName, [{ type: 'service_id', value: `${new_service_id}` }, { type: 'collector', value: 'top' }]);
await grafanaAPI.checkMetricExist(smartMetricName, [{ type: 'service_id', value: new_service_id }, { type: 'collector', value: 'dbstats' }]);
await grafanaAPI.checkMetricAbsent(smartMetricName, [{ type: 'service_id', value: new_service_id }, { type: 'collector', value: 'top' }]);
},
);

Expand Down
3 changes: 2 additions & 1 deletion tests/pages/api/grafanaAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ module.exports = {
// Handle refineBy as a single object with both type and value defined
refineByString = `${refineBy.type}="${refineBy.value}"`;
}

const body = {
queries: [
{
Expand All @@ -399,7 +400,7 @@ module.exports = {
},
{
refId: 'A-Instant',
expr: refineBy ? `${metricName}{${refineBy.type}="${refineBy.value}"}` : metricName,
expr: refineByString ? `${metricName}{${refineByString}}` : metricName,
range: false,
instant: true,
datasource: {
Expand Down
Loading