Skip to content

Commit

Permalink
Fix rules functional test by replacing uptime rule with metric thresh…
Browse files Browse the repository at this point in the history
…old (#163712)

Fixes #163427

## Summary

Fix rules functional test by replacing uptime rule with a metric
threshold as uptime is now replaced with synthetics (Why understand and
solve an issue if we can remove it altogether?! :D)

Flaky test runner [100]:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2859
  • Loading branch information
maryam-saeidi authored Aug 14, 2023
1 parent 458c67e commit 90b011c
Showing 1 changed file with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,30 @@ export default ({ getService }: FtrProviderContext) => {
});

describe('Rules table', () => {
let uptimeRuleId: string;
let metricThresholdRuleId: string;
let logThresholdRuleId: string;
before(async () => {
const uptimeRule = {
const metricThresholdRule = {
params: {
search: '',
numTimes: 5,
timerangeUnit: 'm',
timerangeCount: 15,
shouldCheckStatus: true,
shouldCheckAvailability: true,
availability: { range: 30, rangeUnit: 'd', threshold: '99' },
criteria: [
{
aggType: 'avg',
comparator: '>',
threshold: [0.5],
timeSize: 5,
timeUnit: 'm',
metric: 'system.cpu.user.pct',
},
],
sourceId: 'default',
alertOnNoData: true,
alertOnGroupDisappear: true,
},
consumer: 'alerts',
consumer: 'infrastructure',
tags: ['infrastructure'],
name: 'metric-threshold',
schedule: { interval: '1m' },
tags: [],
name: 'uptime',
rule_type_id: 'xpack.uptime.alerts.monitorStatus',
rule_type_id: 'metrics.alert.threshold',
notify_when: 'onActionGroupChange',
actions: [],
};
Expand All @@ -125,12 +131,12 @@ export default ({ getService }: FtrProviderContext) => {
notify_when: 'onActionGroupChange',
actions: [],
};
uptimeRuleId = await createRule(uptimeRule);
metricThresholdRuleId = await createRule(metricThresholdRule);
logThresholdRuleId = await createRule(logThresholdRule);
await observability.alerts.common.navigateToRulesPage();
});
after(async () => {
await deleteRuleById(uptimeRuleId);
await deleteRuleById(metricThresholdRuleId);
await deleteRuleById(logThresholdRuleId);
});

Expand All @@ -142,7 +148,7 @@ export default ({ getService }: FtrProviderContext) => {
expect(rows.length).to.be(2);
expect(rows[0].name).to.contain('error-log');
expect(rows[0].enabled).to.be('Enabled');
expect(rows[1].name).to.contain('uptime');
expect(rows[1].name).to.contain('metric-threshold');
expect(rows[1].enabled).to.be('Enabled');
});

Expand Down

0 comments on commit 90b011c

Please sign in to comment.