[ML] Fix after all hook for Notifications tests (#142711) (#142961)

(cherry picked from commit da392153d9)

# Conflicts:
#	x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts
This commit is contained in:
Dima Arnautov 2022-10-10 12:23:07 +02:00 committed by GitHub
parent bba1cbfa7d
commit 5d68085274
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const ml = getService('ml');
const browser = getService('browser');
const configs = [
{ jobId: 'fq_001', spaceId: undefined },
{ jobId: 'fq_002', spaceId: 'space1' },
];
describe('Notifications list', function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote');
@ -21,10 +26,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// Prepare jobs to generate notifications
await Promise.all(
[
{ jobId: 'fq_001', spaceId: undefined },
{ jobId: 'fq_002', spaceId: 'space1' },
].map(async (v) => {
configs.map(async (v) => {
const datafeedConfig = ml.commonConfig.getADFqDatafeedConfig(v.jobId);
await ml.api.createAnomalyDetectionJob(
@ -44,7 +46,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
after(async () => {
await ml.api.cleanMlIndices();
for (const { jobId } of configs) {
await ml.api.deleteAnomalyDetectionJobES(jobId);
}
await ml.testResources.cleanMLSavedObjects();
await ml.testResources.deleteIndexPatternByTitle('ft_farequote');
});