mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Fix flaky embeddable alerts panel functional test (#221594)
## Summary Attempt to fix flakyness of the embeddable alerts panel functional test by decreasing the interval of the rules that are used to generate alerts to 5 seconds and parallelizing the execution of async tasks that are not dependent on one another. Not backporting to the 8.x track on purpose since the original PR introducing this functional test hasn't been backported yet because of this issue (will include the same fix in the backport branch).
This commit is contained in:
parent
abf2c2c789
commit
a2a4fc8e1c
1 changed files with 16 additions and 13 deletions
|
@ -52,7 +52,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
name,
|
||||
rule_type_id: `.es-query`,
|
||||
enabled: true,
|
||||
schedule: { interval: '1m' },
|
||||
schedule: { interval: '5s' },
|
||||
consumer: solution === 'stack' ? 'stackAlerts' : 'logs',
|
||||
tags: [name],
|
||||
params: {
|
||||
|
@ -107,7 +107,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
tags: ['security-rule'],
|
||||
setup: '',
|
||||
license: '',
|
||||
interval: '1m',
|
||||
interval: '5s',
|
||||
from: 'now-10m',
|
||||
to: 'now',
|
||||
actions: [],
|
||||
|
@ -144,17 +144,18 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
return summary;
|
||||
};
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/220807
|
||||
describe.skip('Embeddable alerts panel', () => {
|
||||
describe('Embeddable alerts panel', () => {
|
||||
before(async () => {
|
||||
await pageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
|
||||
useActualUrl: true,
|
||||
});
|
||||
await pageObjects.home.addSampleDataSet('logs');
|
||||
const dataView = await getSampleWebLogsDataView();
|
||||
const stackRule = await createEsQueryRule(dataView.id, 'stack');
|
||||
const observabilityRule = await createEsQueryRule(dataView.id, 'observability');
|
||||
const securityRule = await createSecurityRule(dataView.id);
|
||||
const [stackRule, observabilityRule, securityRule] = await Promise.all([
|
||||
createEsQueryRule(dataView.id, 'stack'),
|
||||
createEsQueryRule(dataView.id, 'observability'),
|
||||
createSecurityRule(dataView.id),
|
||||
]);
|
||||
|
||||
// Refresh to see the created rules
|
||||
await browser.refresh();
|
||||
|
@ -170,10 +171,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
const rulesWithoutAlerts = Object.entries(rulesAlerted)
|
||||
.filter(([_, alerted]) => !alerted)
|
||||
.map(([ruleId]) => ruleId);
|
||||
for (const ruleId of rulesWithoutAlerts) {
|
||||
await Promise.all(
|
||||
rulesWithoutAlerts.map(async (ruleId) => {
|
||||
const summary = await getRuleSummary(ruleId);
|
||||
rulesAlerted[ruleId] = Object.keys(summary.alerts).length > 0;
|
||||
}
|
||||
})
|
||||
);
|
||||
expect(Object.values(rulesAlerted).every((hasAlerts) => hasAlerts)).to.be(true);
|
||||
});
|
||||
|
||||
|
@ -208,8 +211,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
await find.clickByCssSelector(`button#security`);
|
||||
|
||||
expect(await find.byButtonText('Switch solution')).to.be.ok();
|
||||
|
||||
await new Promise((r) => setTimeout(r, 20000));
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -237,6 +238,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
expect(options.length).to.equal(1);
|
||||
expect(await options[0].getVisibleText()).to.equal(ruleName);
|
||||
await options[0].click();
|
||||
// Dashboard warnings may appear above the save button
|
||||
await toasts.dismissIfExists();
|
||||
await testSubjects.click(SAVE_CONFIG_BUTTON_SUBJ);
|
||||
await retry.try(() => testSubjects.exists(DASHBOARD_PANEL_TEST_SUBJ));
|
||||
await pageObjects.dashboard.verifyNoRenderErrors();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue