Skip to content

Commit

Permalink
Try to fix the functional flakiness
Browse files Browse the repository at this point in the history
- by creating data views in a serial way
- lets see if that work
  • Loading branch information
kertal committed Mar 28, 2022
1 parent 048fefb commit b6b273a
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import expect from '@kbn/expect';
import { asyncMap, asyncForEach } from '@kbn/std';
import { asyncForEach } from '@kbn/std';
import { last } from 'lodash';
import { FtrProviderContext } from '../../ftr_provider_context';

Expand Down Expand Up @@ -104,16 +104,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
return alerts;
};

const createDataViews = () =>
asyncMap(
[SOURCE_DATA_INDEX, OUTPUT_DATA_INDEX],
async (dataView: string) =>
await supertest
.post(`/api/data_views/data_view`)
.set('kbn-xsrf', 'foo')
.send({ data_view: { title: dataView, timeFieldName: '@timestamp' } })
.expect(200)
);
const createDataView = async (dataView: string) => {
log.debug(`create data view ${dataView}`);
return await supertest
.post(`/api/data_views/data_view`)
.set('kbn-xsrf', 'foo')
.send({ data_view: { title: dataView, timeFieldName: '@timestamp' } })
.expect(200);
};

const createConnector = async (): Promise<string> => {
const { body: createdAction } = await supertest
Expand Down Expand Up @@ -240,10 +238,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug('create output index');
await createOutputDataIndex();

// wait for indices creation finished
await PageObjects.common.sleep(8000);
log.debug('create data views');
const [sourceDataViewResponse, outputDataViewResponse] = await createDataViews();
const sourceDataViewResponse = await createDataView(SOURCE_DATA_INDEX);
const outputDataViewResponse = await createDataView(OUTPUT_DATA_INDEX);

log.debug('create connector');
connectorId = await createConnector();
Expand Down

0 comments on commit b6b273a

Please sign in to comment.