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] Add delay in telemetry test #75162

Merged
merged 10 commits into from
Aug 21, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
import { API_URLS } from '../../../../../plugins/uptime/common/constants';
import { makeChecksWithStatus } from './helper/make_checks';

const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('legacyEs');
Expand Down Expand Up @@ -84,6 +86,7 @@ export default function ({ getService }: FtrProviderContext) {
after('unload heartbeat index', () => getService('esArchiver').unload('uptime/blank'));

beforeEach(async () => {
await delay(1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the delay still needed since we've removed the check for the API response and are now just checking the response code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

await es.indices.refresh();
});

Expand Down Expand Up @@ -120,7 +123,7 @@ export default function ({ getService }: FtrProviderContext) {

it('should receive expected results after calling overview logging', async () => {
// call overview page
const { body: result } = await supertest
await supertest
.post(API_URLS.LOG_PAGE_VIEW)
.set('kbn-xsrf', 'true')
.send({
Expand All @@ -131,21 +134,6 @@ export default function ({ getService }: FtrProviderContext) {
autoRefreshEnabled: true,
})
.expect(200);

expect(result).to.eql({
overview_page: 1,
monitor_page: 1,
no_of_unique_monitors: 4,
settings_page: 0,
monitor_frequency: [120, 0.001, 60, 60],
monitor_name_stats: { min_length: 7, max_length: 22, avg_length: 12 },
no_of_unique_observer_locations: 3,
observer_location_name_stats: { min_length: 2, max_length: 7, avg_length: 4.8 },
dateRangeStart: ['now/d', 'now/d'],
dateRangeEnd: ['now/d', 'now-30'],
autoRefreshEnabled: true,
autorefreshInterval: [100, 60],
});
});
});
}