Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[x-pack/ftr] refactor types to be more accurate/consistent with oss #42407

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,10 @@ module.exports = {
'x-pack/legacy/plugins/apm/**/*.js',
'test/*/config.ts',
'test/visual_regression/tests/**/*',
'x-pack/test/visual_regression/tests/**/*',
'x-pack/test/*/config.ts',
'x-pack/test/*/{tests,test_suites,apis,apps}/**/*',
'x-pack/test/*/*config.*ts',
'x-pack/test/saved_object_api_integration/*/apis/**/*',
'x-pack/test/ui_capabilities/*/tests/**/*',
],
rules: {
'import/no-default-export': 'off',
Expand Down
15 changes: 2 additions & 13 deletions test/api_integration/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
* under the License.
*/

import {
KibanaSupertestProvider,
ElasticsearchSupertestProvider,
ChanceProvider,
} from './services';
import { services } from './services';

export default async function ({ readConfigFile }) {
const commonConfig = await readConfigFile(require.resolve('../common/config'));
Expand All @@ -31,14 +27,7 @@ export default async function ({ readConfigFile }) {
testFiles: [
require.resolve('./apis'),
],
services: {
es: commonConfig.get('services.es'),
esArchiver: commonConfig.get('services.esArchiver'),
retry: commonConfig.get('services.retry'),
supertest: KibanaSupertestProvider,
esSupertest: ElasticsearchSupertestProvider,
chance: ChanceProvider,
},
services,
servers: commonConfig.get('servers'),
junit: {
reportName: 'API Integration Tests'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,19 @@
* under the License.
*/

export { KibanaSupertestProvider, ElasticsearchSupertestProvider } from './supertest';
export { ChanceProvider } from './chance';
import { services as commonServices } from '../../common/services';

// @ts-ignore not TS yet
import { KibanaSupertestProvider, ElasticsearchSupertestProvider } from './supertest';

// @ts-ignore not TS yet
import { ChanceProvider } from './chance';

export const services = {
es: commonServices.es,
esArchiver: commonServices.esArchiver,
retry: commonServices.retry,
supertest: KibanaSupertestProvider,
esSupertest: ElasticsearchSupertestProvider,
chance: ChanceProvider,
};
File renamed without changes.
20 changes: 0 additions & 20 deletions test/types/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import expect from '@kbn/expect';

import { KibanaFunctionalTestDefaultProviders } from '../../../../types/providers';
import { FtrProviderContext } from '../../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function emailTest({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function emailTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

import expect from '@kbn/expect';

import { KibanaFunctionalTestDefaultProviders } from '../../../../types/providers';
import { FtrProviderContext } from '../../../ftr_provider_context';

const ES_TEST_INDEX_NAME = 'functional-test-actions-index';

// eslint-disable-next-line import/no-default-export
export default function indexTest({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function indexTest({ getService }: FtrProviderContext) {
const es = getService('es');
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import expect from '@kbn/expect';

import { KibanaFunctionalTestDefaultProviders } from '../../../../types/providers';
import { FtrProviderContext } from '../../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function serverLogTest({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function serverLogTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

import expect from '@kbn/expect';

import { KibanaFunctionalTestDefaultProviders } from '../../../../types/providers';
import { FtrProviderContext } from '../../../ftr_provider_context';

import { SLACK_ACTION_SIMULATOR_URI } from '../../../fixtures/plugins/actions';

// eslint-disable-next-line import/no-default-export
export default function slackTest({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function slackTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/actions/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
*/

import expect from '@kbn/expect';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function createActionTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function createActionTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/actions/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import expect from '@kbn/expect';

import { ES_ARCHIVER_ACTION_ID, SPACE_1_ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function deleteActionTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function deleteActionTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/actions/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import expect from '@kbn/expect';
import { ES_ARCHIVER_ACTION_ID, SPACE_1_ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function findActionTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function findActionTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/actions/fire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import expect from '@kbn/expect';
import { ES_ARCHIVER_ACTION_ID, SPACE_1_ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const es = getService('es');
Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/actions/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import expect from '@kbn/expect';
import { ES_ARCHIVER_ACTION_ID, SPACE_1_ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function getActionTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function getActionTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function actionsTests({ loadTestFile }: KibanaFunctionalTestDefaultProviders) {
export default function actionsTests({ loadTestFile }: FtrProviderContext) {
describe('Actions', () => {
loadTestFile(require.resolve('./create'));
loadTestFile(require.resolve('./delete'));
Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/actions/list_action_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
*/

import expect from '@kbn/expect';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function listActionTypesTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function listActionTypesTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');

describe('list_action_types', () => {
Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/actions/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import expect from '@kbn/expect';
import { ES_ARCHIVER_ACTION_ID, SPACE_1_ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function updateActionTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function updateActionTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/alerting/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

import expect from '@kbn/expect';
import { getTestAlertData, setupEsTestIndex, destroyEsTestIndex } from './utils';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';
import { ES_ARCHIVER_ACTION_ID, SPACE_1_ES_ARCHIVER_ACTION_ID } from './constants';

// eslint-disable-next-line import/no-default-export
export default function alertTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function alertTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const es = getService('es');
Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/alerting/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import expect from '@kbn/expect';
import { getTestAlertData } from './utils';
import { ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function createAlertTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function createAlertTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const es = getService('es');
Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/alerting/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import expect from '@kbn/expect';
import { getTestAlertData } from './utils';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function createDeleteTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function createDeleteTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const es = getService('es');
Expand Down
7 changes: 2 additions & 5 deletions x-pack/test/api_integration/apis/alerting/disable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
*/

import { getTestAlertData } from './utils';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function createDisableAlertTests({
getService,
}: KibanaFunctionalTestDefaultProviders) {
export default function createDisableAlertTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
7 changes: 2 additions & 5 deletions x-pack/test/api_integration/apis/alerting/enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
*/

import { getTestAlertData } from './utils';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function createEnableAlertTests({
getService,
}: KibanaFunctionalTestDefaultProviders) {
export default function createEnableAlertTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/alerting/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import expect from '@kbn/expect';
import { getTestAlertData } from './utils';
import { ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function createFindTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function createFindTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/alerting/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import expect from '@kbn/expect';
import { getTestAlertData } from './utils';
import { ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function createGetTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function createGetTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/alerting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function alertingTests({ loadTestFile }: KibanaFunctionalTestDefaultProviders) {
export default function alertingTests({ loadTestFile }: FtrProviderContext) {
describe('Alerting', () => {
loadTestFile(require.resolve('./create'));
loadTestFile(require.resolve('./delete'));
Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/alerting/list_alert_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
*/

import expect from '@kbn/expect';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function listAlertTypes({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function listAlertTypes({ getService }: FtrProviderContext) {
const supertest = getService('supertest');

describe('list_alert_types', () => {
Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/alerting/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import expect from '@kbn/expect';
import { getTestAlertData } from './utils';
import { ES_ARCHIVER_ACTION_ID, SPACE_1_ES_ARCHIVER_ACTION_ID } from './constants';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function createUpdateTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function createUpdateTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

Expand Down
5 changes: 2 additions & 3 deletions x-pack/test/api_integration/apis/apm/feature_controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import expect from '@kbn/expect';
import { SecurityService, SpacesService } from '../../../common/services';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function featureControlsTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function featureControlsTests({ getService }: FtrProviderContext) {
const supertest = getService('supertestWithoutAuth');
const security: SecurityService = getService('security');
const spaces: SpacesService = getService('spaces');
Expand Down
Loading