Skip to content

Commit 5ad2732

Browse files
authored
[ML] Functional tests - export service types (#52612) (#52855)
With this PR the types of the ML services that are used in other services are exported from the service file to allow a cleaner re-use.
1 parent cc23912 commit 5ad2732

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

x-pack/test/functional/services/machine_learning/api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import expect from '@kbn/expect';
7+
import { ProvidedType } from '@kbn/test/types/ftr';
78

89
import { FtrProviderContext } from '../../ftr_provider_context';
910

1011
import { JOB_STATE, DATAFEED_STATE } from '../../../../legacy/plugins/ml/common/constants/states';
1112
import { DATA_FRAME_TASK_STATE } from '../../../../legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/common';
1213

14+
export type MlApi = ProvidedType<typeof MachineLearningAPIProvider>;
15+
1316
export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
1417
const es = getService('legacyEs');
1518
const log = getService('log');

x-pack/test/functional/services/machine_learning/common.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6+
import { ProvidedType } from '@kbn/test/types/ftr';
67

78
import { FtrProviderContext } from '../../ftr_provider_context';
89

@@ -11,6 +12,8 @@ interface SetValueOptions {
1112
typeCharByChar?: boolean;
1213
}
1314

15+
export type MlCommon = ProvidedType<typeof MachineLearningCommonProvider>;
16+
1417
export function MachineLearningCommonProvider({ getService }: FtrProviderContext) {
1518
const log = getService('log');
1619
const retry = getService('retry');

x-pack/test/functional/services/machine_learning/custom_urls.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import expect from '@kbn/expect';
7+
import { ProvidedType } from '@kbn/test/types/ftr';
78

89
import { FtrProviderContext } from '../../ftr_provider_context';
910

11+
export type MlCustomUrls = ProvidedType<typeof MachineLearningCustomUrlsProvider>;
12+
1013
export function MachineLearningCustomUrlsProvider({ getService }: FtrProviderContext) {
1114
const testSubjects = getService('testSubjects');
1215

x-pack/test/functional/services/machine_learning/data_frame_analytics.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
import { ProvidedType } from '@kbn/test/types/ftr';
76

87
import { FtrProviderContext } from '../../ftr_provider_context';
9-
import { MachineLearningAPIProvider } from './api';
8+
import { MlApi } from './api';
109

1110
import { DATA_FRAME_TASK_STATE } from '../../../../legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/common';
1211

1312
export function MachineLearningDataFrameAnalyticsProvider(
1413
{ getService }: FtrProviderContext,
15-
mlApi: ProvidedType<typeof MachineLearningAPIProvider>
14+
mlApi: MlApi
1615
) {
1716
const testSubjects = getService('testSubjects');
1817

x-pack/test/functional/services/machine_learning/job_management.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
import { ProvidedType } from '@kbn/test/types/ftr';
76

87
import { FtrProviderContext } from '../../ftr_provider_context';
9-
import { MachineLearningAPIProvider } from './api';
8+
import { MlApi } from './api';
109

1110
import { JOB_STATE, DATAFEED_STATE } from '../../../../legacy/plugins/ml/common/constants/states';
1211

1312
export function MachineLearningJobManagementProvider(
1413
{ getService }: FtrProviderContext,
15-
mlApi: ProvidedType<typeof MachineLearningAPIProvider>
14+
mlApi: MlApi
1615
) {
1716
const testSubjects = getService('testSubjects');
1817

x-pack/test/functional/services/machine_learning/job_wizard_advanced.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import expect from '@kbn/expect';
7-
import { ProvidedType } from '@kbn/test/types/ftr';
87

98
import { FtrProviderContext } from '../../ftr_provider_context';
10-
import { MachineLearningCommonProvider } from './common';
9+
import { MlCommon } from './common';
1110

1211
export function MachineLearningJobWizardAdvancedProvider(
1312
{ getService }: FtrProviderContext,
14-
mlCommon: ProvidedType<typeof MachineLearningCommonProvider>
13+
mlCommon: MlCommon
1514
) {
1615
const comboBox = getService('comboBox');
1716
const testSubjects = getService('testSubjects');

x-pack/test/functional/services/machine_learning/job_wizard_common.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import expect from '@kbn/expect';
7-
import { ProvidedType } from '@kbn/test/types/ftr';
87

98
import { FtrProviderContext } from '../../ftr_provider_context';
10-
import { MachineLearningCommonProvider } from './common';
11-
import { MachineLearningCustomUrlsProvider } from './custom_urls';
9+
import { MlCommon } from './common';
10+
import { MlCustomUrls } from './custom_urls';
1211

1312
export function MachineLearningJobWizardCommonProvider(
1413
{ getService }: FtrProviderContext,
15-
mlCommon: ProvidedType<typeof MachineLearningCommonProvider>,
16-
customUrls: ProvidedType<typeof MachineLearningCustomUrlsProvider>
14+
mlCommon: MlCommon,
15+
customUrls: MlCustomUrls
1716
) {
1817
const comboBox = getService('comboBox');
1918
const retry = getService('retry');

0 commit comments

Comments
 (0)