Skip to content

Commit

Permalink
[ML] Fix after all hook for Notifications tests (elastic#142711)
Browse files Browse the repository at this point in the history
(cherry picked from commit da39215)

# Conflicts:
#	x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts
  • Loading branch information
darnautov committed Oct 10, 2022
1 parent e73f29e commit 0b6bb88
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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(
Expand All @@ -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');
});
Expand Down

0 comments on commit 0b6bb88

Please sign in to comment.