Functional tests - stabilize reporting API network policy test for cloud (#88456)
This PR fixes a reporting API network policy test failure that occurred during cloud execution.
This commit is contained in:
parent
329a5a3f21
commit
b36273693a
|
@ -5,14 +5,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import expect from '@kbn/expect';
|
import expect from '@kbn/expect';
|
||||||
import * as Rx from 'rxjs';
|
|
||||||
import { filter, first, map, switchMap, timeout } from 'rxjs/operators';
|
|
||||||
import { FtrProviderContext } from '../ftr_provider_context';
|
import { FtrProviderContext } from '../ftr_provider_context';
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default function ({ getService }: FtrProviderContext) {
|
export default function ({ getService }: FtrProviderContext) {
|
||||||
const esArchiver = getService('esArchiver');
|
const esArchiver = getService('esArchiver');
|
||||||
const reportingAPI = getService('reportingAPI');
|
const reportingAPI = getService('reportingAPI');
|
||||||
|
const retry = getService('retry');
|
||||||
const supertest = getService('supertest');
|
const supertest = getService('supertest');
|
||||||
const archive = 'reporting/canvas_disallowed_url';
|
const archive = 'reporting/canvas_disallowed_url';
|
||||||
|
|
||||||
|
@ -35,17 +34,10 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Retry the download URL until a "failed" response status is returned
|
// Retry the download URL until a "failed" response status is returned
|
||||||
const fails$: Rx.Observable<string> = Rx.interval(100).pipe(
|
await retry.tryForTime(120000, async () => {
|
||||||
switchMap(() => supertest.get(downloadPath).then((response) => response.body)),
|
const { body } = await supertest.get(downloadPath).expect(500);
|
||||||
filter(({ statusCode }) => statusCode === 500),
|
expect(body.message).to.match(/Reporting generation failed: Error:/);
|
||||||
map(({ message }) => message),
|
});
|
||||||
first(),
|
|
||||||
timeout(120000)
|
|
||||||
);
|
|
||||||
|
|
||||||
const reportFailed = await fails$.toPromise();
|
|
||||||
|
|
||||||
expect(reportFailed).to.match(/Reporting generation failed: Error:/);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue