Skip to content

Commit

Permalink
Add delay in telemetry test
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Aug 17, 2020
1 parent ea54531 commit 78b304b
Showing 1 changed file with 5 additions and 0 deletions.
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);
await es.indices.refresh();
});

Expand Down Expand Up @@ -119,6 +122,8 @@ export default function ({ getService }: FtrProviderContext) {
});

it('should receive expected results after calling overview logging', async () => {
// wait few seconds to make sure data is refreshed, just to avoid flakiness
await delay(2000);
// call overview page
const { body: result } = await supertest
.post(API_URLS.LOG_PAGE_VIEW)
Expand Down

0 comments on commit 78b304b

Please sign in to comment.