From 0b6bb882bf87f4145481a7b2afcf48709d46050e Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Wed, 5 Oct 2022 13:26:06 +0200 Subject: [PATCH] [ML] Fix after all hook for Notifications tests (#142711) (cherry picked from commit da392153d9151fe57f12b158c590b21f84351dda) # Conflicts: # x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts --- .../short_tests/notifications/notification_list.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts b/x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts index c9ad8d2423ef8..494b9256cd6d7 100644 --- a/x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts +++ b/x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts @@ -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'); });