[8.6] [ML] Functional tests - reenable evaluate DFA API tests (#141588) (#149915)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[ML] Functional tests - reenable evaluate DFA API tests
(#141588)](https://github.com/elastic/kibana/pull/141588)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Robert
Oskamp","email":"robert.oskamp@elastic.co"},"sourceCommit":{"committedDate":"2023-01-31T09:26:29Z","message":"[ML]
Functional tests - reenable evaluate DFA API tests (#141588)\n\nThis PR
re-enables the API integration tests for the data_frame/_evaluate
endpoint.","sha":"7d00fa6fa8ac6eeb1fa1c64500fcbb692301e315","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","test_ui_functional","release_note:skip","backport:prev-minor","v8.6.0","v8.7.0"],"number":141588,"url":"https://github.com/elastic/kibana/pull/141588","mergeCommit":{"message":"[ML]
Functional tests - reenable evaluate DFA API tests (#141588)\n\nThis PR
re-enables the API integration tests for the data_frame/_evaluate
endpoint.","sha":"7d00fa6fa8ac6eeb1fa1c64500fcbb692301e315"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/141588","number":141588,"mergeCommit":{"message":"[ML]
Functional tests - reenable evaluate DFA API tests (#141588)\n\nThis PR
re-enables the API integration tests for the data_frame/_evaluate
endpoint.","sha":"7d00fa6fa8ac6eeb1fa1c64500fcbb692301e315"}}]}]
BACKPORT-->

Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
This commit is contained in:
Kibana Machine 2023-01-31 05:19:52 -05:00 committed by GitHub
parent 93086e352a
commit ec5d92f248
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 17 deletions

View file

@ -111,8 +111,7 @@ export default ({ getService }: FtrProviderContext) => {
}
}
// Failing: See https://github.com/elastic/kibana/issues/116056
describe.skip('POST data_frame/_evaluate', () => {
describe('POST data_frame/_evaluate', () => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/bm_classification');
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/egs_regression');
@ -121,7 +120,12 @@ export default ({ getService }: FtrProviderContext) => {
});
after(async () => {
for (const testConfig of testJobConfigs) {
await ml.api.deleteDataFrameAnalyticsJobES(testConfig.config.id!);
}
await ml.api.cleanMlIndices();
await ml.api.syncSavedObjects();
});
testJobConfigs.forEach((testConfig) => {

View file

@ -17,6 +17,11 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
before(async () => {
await ml.securityCommon.createMlRoles();
await ml.securityCommon.createMlUsers();
// ML saved objects (e.g. lang_ident_model_1) might have lost the * space
// assignment when privious test suites loaded and unloaded the .kibana index.
// We're making sure that it's in the expected state again.
await ml.api.initSavedObjects();
});
after(async () => {

View file

@ -93,7 +93,7 @@ export default ({ getService }: FtrProviderContext) => {
await ml.testResources.cleanMLSavedObjects();
});
it(`should get AD jobs for space idSpace1`, async () => {
it(`should get AD jobs for space ${idSpace1}`, async () => {
const resp = await runRequest('anomaly-detector', idSpace1);
const expectedResponse = [
@ -102,14 +102,14 @@ export default ({ getService }: FtrProviderContext) => {
description: 'mean(responsetime) on farequote dataset with 15m bucket span',
jobState: 'closed',
datafeedState: '',
spaces: ['space1'],
spaces: [idSpace1],
},
{
id: adJobIdSpace2s1,
description: 'mean(responsetime) on farequote dataset with 15m bucket span',
jobState: 'closed',
datafeedState: '',
spaces: ['space1'],
spaces: [idSpace1],
},
];
@ -121,7 +121,7 @@ export default ({ getService }: FtrProviderContext) => {
);
});
it(`should get AD jobs for space idSpace2`, async () => {
it(`should get AD jobs for space ${idSpace2}`, async () => {
const resp = await runRequest('anomaly-detector', idSpace2);
const expectedResponse = [
@ -130,7 +130,7 @@ export default ({ getService }: FtrProviderContext) => {
description: 'mean(responsetime) on farequote dataset with 15m bucket span',
jobState: 'closed',
datafeedState: '',
spaces: ['space2'],
spaces: [idSpace2],
},
];
@ -142,7 +142,7 @@ export default ({ getService }: FtrProviderContext) => {
);
});
it(`should get DFA jobs for space idSpace1`, async () => {
it(`should get DFA jobs for space ${idSpace1}`, async () => {
const resp = await runRequest('data-frame-analytics', idSpace1);
const expectedResponse = [
@ -153,7 +153,7 @@ export default ({ getService }: FtrProviderContext) => {
dest_index: `user-${dfaJobIdSpace1s1}`,
job_type: 'classification',
state: 'stopped',
spaces: ['space1'],
spaces: [idSpace1],
},
{
id: dfaJobIdSpace2s1,
@ -162,7 +162,7 @@ export default ({ getService }: FtrProviderContext) => {
dest_index: `user-${dfaJobIdSpace2s1}`,
job_type: 'classification',
state: 'stopped',
spaces: ['space1'],
spaces: [idSpace1],
},
];
expect(resp).to.eql(
@ -173,7 +173,7 @@ export default ({ getService }: FtrProviderContext) => {
);
});
it(`should get DFA jobs for space idSpace2`, async () => {
it(`should get DFA jobs for space ${idSpace2}`, async () => {
const resp = await runRequest('data-frame-analytics', idSpace2);
const expectedResponse = [
@ -184,7 +184,7 @@ export default ({ getService }: FtrProviderContext) => {
dest_index: `user-${dfaJobIdSpace3s2}`,
job_type: 'classification',
state: 'stopped',
spaces: ['space2'],
spaces: [idSpace2],
},
];
expect(resp).to.eql(
@ -195,7 +195,7 @@ export default ({ getService }: FtrProviderContext) => {
);
});
it(`should get trained models for space idSpace1`, async () => {
it(`should get trained models for space ${idSpace1}`, async () => {
const resp = await runRequest('trained-model', idSpace1);
const expectedResponse = [
@ -211,14 +211,14 @@ export default ({ getService }: FtrProviderContext) => {
description: '',
state: '',
type: ['tree_ensemble', 'regression'],
spaces: ['space1'],
spaces: [idSpace1],
},
{
id: trainedModelIdSpace2s1,
description: '',
state: '',
type: ['tree_ensemble', 'regression'],
spaces: ['space1'],
spaces: [idSpace1],
},
];
expect(resp).to.eql(
@ -229,7 +229,7 @@ export default ({ getService }: FtrProviderContext) => {
);
});
it(`should get trained models for space idSpace2`, async () => {
it(`should get trained models for space ${idSpace2}`, async () => {
const resp = await runRequest('trained-model', idSpace2);
const expectedResponse = [
@ -245,7 +245,7 @@ export default ({ getService }: FtrProviderContext) => {
description: '',
state: '',
type: ['tree_ensemble', 'regression'],
spaces: ['space2'],
spaces: [idSpace2],
},
];