Skip to content

Commit

Permalink
PMM-T2282 Verfied Alerting is able to monitor for "PMM Agent Down"
Browse files Browse the repository at this point in the history
Automated Test
  • Loading branch information
saikumar-vs committed Jul 19, 2023
1 parent 55e4215 commit 2689e28
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
29 changes: 28 additions & 1 deletion tests/ia/alertRules_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,38 @@ Scenario(
// FIXME: unskip after https://jira.percona.com/browse/PMM-11399 is fixed
// I.verifyPopUpMessage(alertRulesPage.messages.successRuleCreate(newRule.ruleName));
alertRulesPage.verifyRuleList(newRule.folder, newRule.ruleName);
I.seeTextEquals('Normal', alertRulesPage.elements.ruleState);
await alertRulesPage.verifyRuleState('Normal',60);
await rulesAPI.removeAlertRule(newRule.folder);
},
).retry(1);

Scenario(
'PMM-T2282 Verfied Alerting is able to monitor for "PMM Agent Down" @ia @alerting-fb',
async ({ I, alertRulesPage, rulesAPI }) => {
const rule = page.rules[29];
const newRule = page.rules[30];

alertRulesPage.openAlertRulesTab();
I.waitForEnabled(alertRulesPage.buttons.newAlertRule, 10);
I.click(alertRulesPage.buttons.newAlertRule);
await alertRulesPage.fillPerconaAlert(rule,newRule);
I.click(alertRulesPage.buttons.saveAndExit);
// FIXME: unskip after https://jira.percona.com/browse/PMM-11399 is fixed
// I.verifyPopUpMessage(alertRulesPage.messages.successRuleCreate(newRule.ruleName));
await alertRulesPage.verifyRuleList(newRule.folder, newRule.ruleName);
await I.verifyCommand('docker pause ms_pmm_8.0');
await alertRulesPage.verifyRuleState('Pending',180);
//await I.waitForText('Pending', 180, alertRulesPage.elements.ruleState1);
await alertRulesPage.verifyRuleState('Firing',180);
//await I.waitForText('Firing', 180, alertRulesPage.elements.ruleState2);
await I.verifyCommand('docker unpause ms_pmm_8.0');
//await I.waitForText('Normal', 180, alertRulesPage.elements.ruleState3);
await alertRulesPage.verifyRuleState('Normal',180);
await rulesAPI.removeAlertRule(newRule.folder);
},
).retry(1);


// TODO: check ovf failure
Scenario(
'PMM-T1430 Verify user can edit Percona templated alert @ia @not-ovf @alerting-fb',
Expand Down
11 changes: 9 additions & 2 deletions tests/ia/pages/alertRulesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
noRules: 'div.page-body > div',
columnHeaderLocator: (columnHeaderText) => locate('$header').withText(columnHeaderText),
ruleNameValue: 'div[data-column=\'Name\']',
ruleState: '//div[@data-column=\'State\']//div//span',
ruleState: (text) => `//span[contains(.,'${text}')]`,
ruleDetails: 'div[data-testid=\'expanded-content\']',
searchByDataSourceDropdown: '//div[@aria-label="Data source picker select container"]',
searchByLabel: '$input-wrapper',
Expand Down Expand Up @@ -79,7 +79,10 @@ module.exports = {
I.waitForElement(this.fields.templatesLoader);
this.searchAndSelectResult('template', template);
this.verifyAndReplaceInputField('ruleName', ruleName, editedRule.ruleName);
this.verifyAndReplaceInputField('threshold', threshold, editedRule.threshold);
const thresholdExists = await I.grabNumberOfVisibleElements(this.fields.resultsLocator(threshold));
if (thresholdExists >0 ) {
this.verifyAndReplaceInputField('threshold', threshold, editedRule.threshold);
}
this.verifyAndReplaceInputField('duration', duration, editedRule.duration);
I.see(severity, this.fields.searchDropdown('severity'));
this.searchAndSelectResult('severity', editedRule.severity);
Expand Down Expand Up @@ -146,4 +149,8 @@ module.exports = {
I.click(this.buttons.groupCollapseButton(folder));
I.seeTextEquals(ruleName, this.elements.ruleNameValue);
},

verifyRuleState(ruleName, timeOut) {
I.waitForText(ruleName, timeOut, this.elements.ruleState(ruleName));
},
};
14 changes: 14 additions & 0 deletions tests/ia/pages/testData.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,20 @@ module.exports = {
],
channels: [],
activate: true,
}, {
template: 'PMM agent down',
ruleName: 'pmm_agent_down Alerting Rule',
threshold: null,
duration: '60s',
severity: 'Critical',
folder: 'Experimental',
}, {
template: 'PMM agent down',
ruleName: 'Custom pmm_agent_down Alerting Rule',
threshold: null,
duration: '60s',
severity: 'Critical',
folder: 'Experimental',
}],
templates: [{
template: 'Memory used by MongoDB connections',
Expand Down

0 comments on commit 2689e28

Please sign in to comment.