Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Uptime] Unskip flaky tests #130059

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/plugins/uptime/e2e/journeys/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export * from './monitor_name.journey';
export * from './monitor_management.journey';
export * from './monitor_management_enablement.journey';
export * from './monitor_details';
export * from './locations';
8 changes: 8 additions & 0 deletions x-pack/plugins/uptime/e2e/journeys/locations/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export * from './locations';
93 changes: 93 additions & 0 deletions x-pack/plugins/uptime/e2e/journeys/locations/locations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { journey, step, before, Page } from '@elastic/synthetics';
import { makeChecksWithStatus } from '../../helpers/make_checks';
import { monitorDetailsPageProvider } from '../../page_objects/monitor_details';

journey('Observer location', async ({ page, params }: { page: Page; params: any }) => {
const monitorDetails = monitorDetailsPageProvider({ page, kibanaUrl: params.kibanaUrl });

const NO_LOCATION_MONITOR_ID = 'location-testing-id';

const LESS_AVAIL_MONITOR_ID = 'less-availability-monitor';

const addMonitorWithNoLocation = async () => {
/**
* This mogrify function will strip the documents of their location
* data (but preserve their location name), which is necessary for
* this test to work as desired.
* @param d current document
*/
const mogrifyNoLocation = (d: any) => {
if (d.observer?.geo?.location) {
d.observer.geo.location = undefined;
}
return d;
};
await makeChecksWithStatus(
params.getService('es'),
NO_LOCATION_MONITOR_ID,
5,
2,
10000,
{},
'up',
mogrifyNoLocation
);
};

const addLessAvailMonitor = async () => {
await makeChecksWithStatus(
params.getService('es'),
LESS_AVAIL_MONITOR_ID,
5,
2,
10000,
{},
'up'
);
await makeChecksWithStatus(
params.getService('es'),
LESS_AVAIL_MONITOR_ID,
5,
2,
10000,
{},
'down'
);
};

before(async () => {
await addMonitorWithNoLocation();
await addLessAvailMonitor();
});

step('navigate to overview', async () => {
await monitorDetails.navigateToOverviewPage();
});

step('login to Kibana', async () => {
await monitorDetails.loginToKibana();
});

step('navigate to monitor details for no locaiton monitor', async () => {
await monitorDetails.navigateToMonitorDetails(NO_LOCATION_MONITOR_ID);
});

step('displays the overall availability', async () => {
await monitorDetails.waitForLoadingToFinish();
const availability = '100.00 %';
await monitorDetails.assertText({ text: availability });
});

step('displays less monitor availability', async () => {
await monitorDetails.navigateToOverviewPage();
await monitorDetails.navigateToMonitorDetails(LESS_AVAIL_MONITOR_ID);
await monitorDetails.assertText({ text: '50.00 %' });
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export const uptimeRouteWrapper: UMKibanaRouteWrapper = (uptimeRoute, server) =>

server.uptimeEsClient = uptimeEsClient;

if (isInspectorEnabled || server.isDev) {
if (
(isInspectorEnabled || server.isDev) &&
server.config.service?.username !== 'localKibanaIntegrationTestsUser'
) {
inspectableEsQueriesMap.set(request, []);
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ interface ExpectedMonitorStatesPage {
response: any;
statesIds: string[];
statuses: string[];
absFrom: number;
absTo: number;
size: number;
prevPagination: null | string;
nextPagination: null | string;
Expand All @@ -34,8 +32,6 @@ const checkMonitorStatesResponse = ({
response,
statesIds,
statuses,
absFrom,
absTo,
size,
prevPagination,
nextPagination,
Expand All @@ -52,11 +48,6 @@ const checkMonitorStatesResponse = ({
).to.eql(statuses);
(summaries ?? []).forEach((s) => {
expect(s.state.url.full).to.be.ok();
expect(Array.isArray(s.histogram?.points)).to.be(true);
(s.histogram?.points ?? []).forEach((point) => {
expect(point.timestamp).to.be.greaterThan(absFrom);
expect(point.timestamp).to.be.lessThan(absTo);
});
});
expect(prevPagePagination).to.be(prevPagination);
expect(nextPagePagination).to.eql(nextPagination);
Expand All @@ -65,12 +56,9 @@ const checkMonitorStatesResponse = ({

export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
// Failing ES Promotion: https://github.com/elastic/kibana/issues/93705
describe.skip('monitor states endpoint', () => {
describe('monitor states endpoint', () => {
const from = '2019-09-11T03:30:04.380Z';
const to = '2019-09-11T03:40:34.410Z';
const absFrom = new Date(from).valueOf();
const absTo = new Date(to).valueOf();

it('will fetch monitor state data for the given filters and range', async () => {
const statusFilter = 'up';
Expand All @@ -84,8 +72,6 @@ export default function ({ getService }: FtrProviderContext) {
response: apiResponse.body,
statesIds: ['0002-up'],
statuses: ['up'],
absFrom,
absTo,
size: 1,
prevPagination: null,
nextPagination: null,
Expand Down Expand Up @@ -480,8 +466,6 @@ export default function ({ getService }: FtrProviderContext) {
checkMonitorStatesResponse({
response: nextData,
...expectedNextResults[page - 1],
absFrom,
absTo,
size,
});

Expand All @@ -493,8 +477,6 @@ export default function ({ getService }: FtrProviderContext) {
checkMonitorStatesResponse({
response: prevData,
...expectedPrevResults[page - 2],
absFrom,
absTo,
size,
});
}
Expand All @@ -521,8 +503,6 @@ export default function ({ getService }: FtrProviderContext) {
'0009-up',
],
statuses: ['up', 'up', 'up', 'up', 'up', 'up', 'up', 'up', 'up', 'up'],
absFrom,
absTo,
size: LENGTH,
prevPagination: null,
nextPagination:
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/functional/apps/uptime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default ({ loadTestFile, getService }: FtrProviderContext) => {
await esArchiver.unload('x-pack/test/functional/es_archives/uptime/blank');
});

loadTestFile(require.resolve('./locations'));
loadTestFile(require.resolve('./settings'));
loadTestFile(require.resolve('./certificates'));
});
Expand Down
Loading