[IngestManager] fix endpoint setup in api integration tests (#69503)

This commit is contained in:
Nicolas Chaulet 2020-06-18 11:37:14 -04:00 committed by GitHub
parent a383468163
commit 338ae00384
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { FtrProviderContext } from '../ftr_provider_context';
import { setupRouteService, fleetSetupRouteService } from '../../../plugins/ingest_manager/common';
import { fleetSetupRouteService } from '../../../plugins/ingest_manager/common';
export function IngestManagerProvider({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
@ -12,14 +12,11 @@ export function IngestManagerProvider({ getService }: FtrProviderContext) {
async setup() {
const headers = { accept: 'application/json', 'kbn-xsrf': 'some-xsrf-token' };
const { body } = await supertest
.get(fleetSetupRouteService.getFleetSetupPath())
await supertest
.post(fleetSetupRouteService.postFleetSetupPath())
.set(headers)
.send({ forceRecreate: true })
.expect(200);
if (!body.isInitialized) {
await supertest.post(setupRouteService.getSetupPath()).set(headers).expect(200);
}
},
};
}