Skip to content

Commit

Permalink
Make uptime alert flyout test a little more resilient (elastic#62702)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders authored and Maja Grubic committed Apr 16, 2020
1 parent 910e2b8 commit 19fc959
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// put the fetch code in a retry block with a timeout.
let alert: any;
await retry.tryForTime(15000, async () => {
const apiResponse = await supertest.get('/api/alert/_find');
const apiResponse = await supertest.get('/api/alert/_find?search=uptime-test');
const alertsFromThisTest = apiResponse.body.data.filter(
({ name }: { name: string }) => name === 'uptime-test'
);
Expand All @@ -54,25 +54,27 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
tags,
} = alert;

// we're not testing the flyout's ability to associate alerts with action connectors
expect(actions).to.eql([]);
try {
// we're not testing the flyout's ability to associate alerts with action connectors
expect(actions).to.eql([]);

expect(alertTypeId).to.eql('xpack.uptime.alerts.monitorStatus');
expect(consumer).to.eql('uptime');
expect(interval).to.eql('11m');
expect(tags).to.eql(['uptime', 'another']);
expect(numTimes).to.be(3);
expect(timerange.from).to.be('now-1h');
expect(timerange.to).to.be('now');
expect(locations).to.eql(['mpls']);
expect(filters).to.eql(
'{"bool":{"should":[{"match_phrase":{"monitor.id":"0001-up"}}],"minimum_should_match":1}}'
);

await supertest
.delete(`/api/alert/${id}`)
.set('kbn-xsrf', 'true')
.expect(204);
expect(alertTypeId).to.eql('xpack.uptime.alerts.monitorStatus');
expect(consumer).to.eql('uptime');
expect(interval).to.eql('11m');
expect(tags).to.eql(['uptime', 'another']);
expect(numTimes).to.be(3);
expect(timerange.from).to.be('now-1h');
expect(timerange.to).to.be('now');
expect(locations).to.eql(['mpls']);
expect(filters).to.eql(
'{"bool":{"should":[{"match_phrase":{"monitor.id":"0001-up"}}],"minimum_should_match":1}}'
);
} finally {
await supertest
.delete(`/api/alert/${id}`)
.set('kbn-xsrf', 'true')
.expect(204);
}
});
});
};

0 comments on commit 19fc959

Please sign in to comment.