Skip to content

Commit

Permalink
[Uptime] Unskip alert functional test (#101562) (#101938)
Browse files Browse the repository at this point in the history
Co-authored-by: Shahzad <[email protected]>
  • Loading branch information
kibanamachine and shahzad31 authored Jun 10, 2021
1 parent 20dca72 commit 7a3f111
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const AlertQueryBar = ({ query = '', onChange }: Props) => {
}}
query={{ query: inputVal, language: 'kuery' }}
aria-label={labels.ALERT_KUERY_BAR_ARIA}
data-test-subj="xpack.uptime.alerts.monitorStatus.filterBar"
dataTestSubj="xpack.uptime.alerts.monitorStatus.filterBar"
autoSubmit={true}
disableLanguageSwitcher={true}
isInvalid={!!(inputVal && !query)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ export const AlertMonitorStatus: React.FC<Props> = ({
}) => {
const dispatch = useDispatch();
useEffect(() => {
dispatch(
fetchOverviewFilters({
dateRangeStart: 'now-24h',
dateRangeEnd: 'now',
locations: alertParams.filters?.['observer.geo.name'] ?? [],
ports: alertParams.filters?.['url.port'] ?? [],
tags: alertParams.filters?.tags ?? [],
schemes: alertParams.filters?.['monitor.type'] ?? [],
})
);
if (!window.location.pathname.includes('/app/uptime')) {
// filters inside uptime app already loaded
dispatch(
fetchOverviewFilters({
dateRangeStart: 'now-24h',
dateRangeEnd: 'now',
locations: alertParams.filters?.['observer.geo.name'] ?? [],
ports: alertParams.filters?.['url.port'] ?? [],
tags: alertParams.filters?.tags ?? [],
schemes: alertParams.filters?.['monitor.type'] ?? [],
})
);
}
}, [alertParams, dispatch]);

const overviewFilters = useSelector(overviewFiltersSelector);
Expand Down
11 changes: 7 additions & 4 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 @@ -6,11 +6,12 @@
*/

import expect from '@kbn/expect';
import { delay } from 'bluebird';

import { FtrProviderContext } from '../../ftr_provider_context';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
// FLAKY: https://github.com/elastic/kibana/issues/88177
describe.skip('uptime alerts', () => {
describe('uptime alerts', () => {
const pageObjects = getPageObjects(['common', 'uptime']);
const supertest = getService('supertest');
const retry = getService('retry');
Expand Down Expand Up @@ -91,11 +92,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// put the fetch code in a retry block with a timeout.
let alert: any;
await retry.tryForTime(60 * 1000, async () => {
// add a delay before next call to not overload the server
await delay(1500);
const apiResponse = await supertest.get('/api/alerts/_find?search=uptime-test');
const alertsFromThisTest = apiResponse.body.data.filter(
({ name }: { name: string }) => name === 'uptime-test'
);
expect(alertsFromThisTest).to.have.length(1);
expect(alertsFromThisTest.length >= 1).to.be(true);
alert = alertsFromThisTest[0];
});

Expand Down Expand Up @@ -124,7 +127,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
expect(timerangeUnit).to.be('h');
expect(timerangeCount).to.be(1);
expect(JSON.stringify(filters)).to.eql(
`{"url.port":["5678"],"observer.geo.name":["mpls"],"monitor.type":["http"],"tags":[]}`
`{"tags":[],"url.port":["5678"],"observer.geo.name":["mpls"],"monitor.type":["http"]}`
);
} finally {
await supertest.delete(`/api/alerts/alert/${id}`).set('kbn-xsrf', 'true').expect(204);
Expand Down

0 comments on commit 7a3f111

Please sign in to comment.