mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Chore] [Synthetics] Unskip previously flaky test (#214276)
## Summary Fixes https://github.com/elastic/kibana/issues/196257 Fixes https://github.com/elastic/kibana/issues/202337 Unskip flaky test Adjusted some assertions for more reliability. The final flaky test runner passed for 200 iterations.
This commit is contained in:
parent
0a10127efc
commit
dfb16cbe46
1 changed files with 59 additions and 32 deletions
|
@ -22,15 +22,16 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
const esDeleteAllIndices = getService('esDeleteAllIndices');
|
||||
const supertest = getService('supertest');
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/202337
|
||||
// Failing: See https://github.com/elastic/kibana/issues/196257
|
||||
describe.skip('SyntheticsCustomStatusRule', () => {
|
||||
describe('SyntheticsCustomStatusRule', () => {
|
||||
const SYNTHETICS_RULE_ALERT_INDEX = '.alerts-observability.uptime.alerts-default';
|
||||
|
||||
before(async () => {
|
||||
await server.savedObjects.cleanStandardList();
|
||||
await esDeleteAllIndices([SYNTHETICS_ALERT_ACTION_INDEX]);
|
||||
await ruleHelper.createIndexAction();
|
||||
await esClient.deleteByQuery({
|
||||
index: SYNTHETICS_RULE_ALERT_INDEX,
|
||||
query: { match_all: {} },
|
||||
});
|
||||
await supertest
|
||||
.put(SYNTHETICS_API_URLS.SYNTHETICS_ENABLEMENT)
|
||||
.set('kbn-xsrf', 'true')
|
||||
|
@ -40,10 +41,6 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
after(async () => {
|
||||
await server.savedObjects.cleanStandardList();
|
||||
await esDeleteAllIndices([SYNTHETICS_ALERT_ACTION_INDEX]);
|
||||
await esClient.deleteByQuery({
|
||||
index: SYNTHETICS_RULE_ALERT_INDEX,
|
||||
query: { match_all: {} },
|
||||
});
|
||||
});
|
||||
|
||||
/* 1. create a monitor
|
||||
|
@ -71,14 +68,13 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
let monitor: any;
|
||||
let docs: any[] = [];
|
||||
|
||||
before(async () => {
|
||||
await server.savedObjects.clean({ types: ['synthetics-monitor', 'rule'] });
|
||||
});
|
||||
|
||||
it('creates a monitor', async () => {
|
||||
monitor = await ruleHelper.addMonitor('Monitor check based at ' + moment().format('LLL'));
|
||||
expect(monitor).to.have.property('id');
|
||||
|
||||
docs = await ruleHelper.makeSummaries({
|
||||
monitor,
|
||||
downChecks: 5,
|
||||
});
|
||||
});
|
||||
|
||||
it('creates a custom rule', async () => {
|
||||
|
@ -102,6 +98,10 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
it('should trigger down alert', async function () {
|
||||
docs = await ruleHelper.makeSummaries({
|
||||
monitor,
|
||||
downChecks: 5,
|
||||
});
|
||||
const response = await ruleHelper.waitForStatusAlert({
|
||||
ruleId,
|
||||
});
|
||||
|
@ -191,6 +191,10 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
let ruleId = '';
|
||||
let monitor: any;
|
||||
|
||||
before(async () => {
|
||||
await server.savedObjects.clean({ types: ['synthetics-monitor', 'rule'] });
|
||||
});
|
||||
|
||||
it('creates a monitor', async () => {
|
||||
monitor = await ruleHelper.addMonitor('Monitor location based at ' + moment().format('LT'));
|
||||
expect(monitor).to.have.property('id');
|
||||
|
@ -283,6 +287,10 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
let monitor: any;
|
||||
let docs: any[] = [];
|
||||
|
||||
before(async () => {
|
||||
await server.savedObjects.clean({ types: ['synthetics-monitor', 'rule'] });
|
||||
});
|
||||
|
||||
it('creates a monitor', async () => {
|
||||
monitor = await ruleHelper.addMonitor(
|
||||
`Monitor check based at ${moment().format('LLL')} ungrouped`
|
||||
|
@ -410,6 +418,10 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
let ruleId = '';
|
||||
let monitor: any;
|
||||
|
||||
before(async () => {
|
||||
await server.savedObjects.clean({ types: ['synthetics-monitor', 'rule'] });
|
||||
});
|
||||
|
||||
it('creates a monitor', async () => {
|
||||
monitor = await ruleHelper.addMonitor(
|
||||
`Monitor location based at ${moment().format('LT')} ungrouped 2 locations`
|
||||
|
@ -525,6 +537,9 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
{
|
||||
term: { 'monitor.id': monitor.id },
|
||||
},
|
||||
{
|
||||
term: { status: 'active' },
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(downResponse.hits.hits[0]._source).property(
|
||||
|
@ -576,26 +591,29 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
indexName: SYNTHETICS_ALERT_ACTION_INDEX,
|
||||
retryService,
|
||||
logger,
|
||||
docCountTarget: 2,
|
||||
docCountTarget: 1,
|
||||
filters: [
|
||||
{
|
||||
term: { 'monitor.id': monitor.id },
|
||||
},
|
||||
{
|
||||
term: { status: 'recovered' },
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(recoveryResponse.hits.hits[1]._source).property(
|
||||
expect(recoveryResponse.hits.hits[0]._source).property(
|
||||
'reason',
|
||||
`Monitor "${monitor.name}" from Dev Service and Dev Service 2 is recovered. Alert when 1 out of the last 1 checks are down from at least 2 locations.`
|
||||
);
|
||||
expect(recoveryResponse.hits.hits[1]._source).property(
|
||||
expect(recoveryResponse.hits.hits[0]._source).property(
|
||||
'locationNames',
|
||||
'Dev Service and Dev Service 2'
|
||||
);
|
||||
expect(recoveryResponse.hits.hits[1]._source).property(
|
||||
expect(recoveryResponse.hits.hits[0]._source).property(
|
||||
'linkMessage',
|
||||
`- Link: https://localhost:5601/app/synthetics/monitor/${monitor.id}/errors/Test%20private%20location-18524a3d9a7-0?locationId=dev`
|
||||
);
|
||||
expect(recoveryResponse.hits.hits[1]._source).property('locationId', 'dev and dev2');
|
||||
expect(recoveryResponse.hits.hits[0]._source).property('locationId', 'dev and dev2');
|
||||
});
|
||||
|
||||
let downDocs: any[] = [];
|
||||
|
@ -629,22 +647,23 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
indexName: SYNTHETICS_ALERT_ACTION_INDEX,
|
||||
retryService,
|
||||
logger,
|
||||
docCountTarget: 3,
|
||||
filters: [{ term: { 'monitor.id': monitor.id } }],
|
||||
docCountTarget: 2,
|
||||
filters: [{ term: { 'monitor.id': monitor.id } }, { term: { status: 'active' } }],
|
||||
});
|
||||
expect(downResponse.hits.hits[2]._source).property(
|
||||
|
||||
expect(downResponse.hits.hits[1]._source).property(
|
||||
'reason',
|
||||
`Monitor "${monitor.name}" is down 1 time from Dev Service and 1 time from Dev Service 2. Alert when down 1 time out of the last 1 checks from at least 2 locations.`
|
||||
);
|
||||
expect(downResponse.hits.hits[2]._source).property(
|
||||
expect(downResponse.hits.hits[1]._source).property(
|
||||
'locationNames',
|
||||
'Dev Service and Dev Service 2'
|
||||
);
|
||||
expect(downResponse.hits.hits[2]._source).property(
|
||||
expect(downResponse.hits.hits[1]._source).property(
|
||||
'linkMessage',
|
||||
`- Link: https://localhost:5601/app/synthetics/monitor/${monitor.id}/errors/Test%20private%20location-18524a3d9a7-0?locationId=dev`
|
||||
);
|
||||
expect(downResponse.hits.hits[2]._source).property('locationId', 'dev and dev2');
|
||||
expect(downResponse.hits.hits[1]._source).property('locationId', 'dev and dev2');
|
||||
});
|
||||
|
||||
it('should trigger recovered alert when the location threshold is no longer met', async () => {
|
||||
|
@ -673,27 +692,27 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
indexName: SYNTHETICS_ALERT_ACTION_INDEX,
|
||||
retryService,
|
||||
logger,
|
||||
docCountTarget: 4,
|
||||
filters: [{ term: { 'monitor.id': monitor.id } }],
|
||||
docCountTarget: 2,
|
||||
filters: [{ term: { 'monitor.id': monitor.id } }, { term: { status: 'recovered' } }],
|
||||
});
|
||||
expect(recoveryResponse.hits.hits[3]._source).property(
|
||||
expect(recoveryResponse.hits.hits[1]._source).property(
|
||||
'reason',
|
||||
`Monitor "${monitor.name}" from Dev Service and Dev Service 2 is recovered. Alert when 1 out of the last 1 checks are down from at least 2 locations.`
|
||||
);
|
||||
expect(recoveryResponse.hits.hits[3]._source).property(
|
||||
expect(recoveryResponse.hits.hits[1]._source).property(
|
||||
'locationNames',
|
||||
'Dev Service and Dev Service 2'
|
||||
);
|
||||
expect(recoveryResponse.hits.hits[3]._source).property(
|
||||
expect(recoveryResponse.hits.hits[1]._source).property(
|
||||
'linkMessage',
|
||||
`- Link: https://localhost:5601/app/synthetics/monitor/${monitor.id}/errors/Test%20private%20location-18524a3d9a7-0?locationId=dev`
|
||||
);
|
||||
expect(recoveryResponse.hits.hits[3]._source).property('locationId', 'dev and dev2');
|
||||
expect(recoveryResponse.hits.hits[3]._source).property(
|
||||
expect(recoveryResponse.hits.hits[1]._source).property('locationId', 'dev and dev2');
|
||||
expect(recoveryResponse.hits.hits[1]._source).property(
|
||||
'recoveryReason',
|
||||
'the alert condition is no longer met'
|
||||
);
|
||||
expect(recoveryResponse.hits.hits[3]._source).property('recoveryStatus', 'has recovered');
|
||||
expect(recoveryResponse.hits.hits[1]._source).property('recoveryStatus', 'has recovered');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -701,6 +720,10 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
let ruleId = '';
|
||||
let monitor: any;
|
||||
|
||||
before(async () => {
|
||||
await server.savedObjects.clean({ types: ['synthetics-monitor', 'rule'] });
|
||||
});
|
||||
|
||||
it('creates a monitor', async () => {
|
||||
monitor = await ruleHelper.addMonitor('Monitor time based at ' + moment().format('LT'));
|
||||
expect(monitor).to.have.property('id');
|
||||
|
@ -825,6 +848,10 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
let ruleId = '';
|
||||
let monitor: any;
|
||||
|
||||
before(async () => {
|
||||
await server.savedObjects.clean({ types: ['synthetics-monitor', 'rule'] });
|
||||
});
|
||||
|
||||
it('creates a monitor', async () => {
|
||||
monitor = await ruleHelper.addMonitor(
|
||||
`Monitor time based at ${moment().format('LT')} grouped 2 locations`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue