Skip to content

Commit

Permalink
[ML] Functional tests - export service types (elastic#52612) (elastic…
Browse files Browse the repository at this point in the history
…#52857)

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.
  • Loading branch information
pheyos committed Dec 12, 2019
1 parent d0a9ed1 commit d05585e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions x-pack/test/functional/services/machine_learning/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect';
import { ProvidedType } from '@kbn/test/types/ftr';

import { isEmpty } from 'lodash';
import { FtrProviderContext } from '../../ftr_provider_context';

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

export type MlApi = ProvidedType<typeof MachineLearningAPIProvider>;

export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
const es = getService('legacyEs');
const log = getService('log');
Expand Down
3 changes: 3 additions & 0 deletions x-pack/test/functional/services/machine_learning/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ProvidedType } from '@kbn/test/types/ftr';

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

Expand All @@ -11,6 +12,8 @@ interface SetValueOptions {
typeCharByChar?: boolean;
}

export type MlCommon = ProvidedType<typeof MachineLearningCommonProvider>;

export function MachineLearningCommonProvider({ getService }: FtrProviderContext) {
const log = getService('log');
const retry = getService('retry');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ProvidedType } from '@kbn/test/types/ftr';

import { FtrProviderContext } from '../../ftr_provider_context';
import { MachineLearningAPIProvider } from './api';
import { MlApi } from './api';

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

export function MachineLearningJobManagementProvider(
{ getService }: FtrProviderContext,
mlApi: ProvidedType<typeof MachineLearningAPIProvider>
mlApi: MlApi
) {
const testSubjects = getService('testSubjects');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect';
import { ProvidedType } from '@kbn/test/types/ftr';

import { FtrProviderContext } from '../../ftr_provider_context';
import { MachineLearningCommonProvider } from './common';
import { MlCommon } from './common';

export function MachineLearningJobWizardAdvancedProvider(
{ getService }: FtrProviderContext,
mlCommon: ProvidedType<typeof MachineLearningCommonProvider>
mlCommon: MlCommon
) {
const comboBox = getService('comboBox');
const testSubjects = getService('testSubjects');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect';
import { ProvidedType } from '@kbn/test/types/ftr';

import { FtrProviderContext } from '../../ftr_provider_context';
import { MachineLearningCommonProvider } from './common';
import { MlCommon } from './common';

export function MachineLearningJobWizardCommonProvider(
{ getService }: FtrProviderContext,
mlCommon: ProvidedType<typeof MachineLearningCommonProvider>
mlCommon: MlCommon
) {
const comboBox = getService('comboBox');
const retry = getService('retry');
Expand Down

0 comments on commit d05585e

Please sign in to comment.