[x-pack/ftr] refactor types to be more accurate/consistent wit… (#42407)

This commit is contained in:
Spencer 2019-08-02 15:43:05 -07:00 committed by GitHub
parent 7a89b7aabd
commit d66b3c74eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
276 changed files with 1024 additions and 1408 deletions

View file

@ -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',

View file

@ -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'));
@ -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'

View file

@ -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,
};

View file

@ -1,20 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export * from './mocha_decorations';

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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'));

View file

@ -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', () => {

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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'));

View file

@ -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', () => {

View file

@ -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');

View file

@ -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');

View file

@ -4,12 +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 apmApiIntegrationTests({
loadTestFile,
}: KibanaFunctionalTestDefaultProviders) {
export default function apmApiIntegrationTests({ loadTestFile }: FtrProviderContext) {
describe('APM', () => {
loadTestFile(require.resolve('./feature_controls'));
});

View file

@ -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');

View file

@ -4,12 +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 apmApiIntegrationTests({
loadTestFile,
}: KibanaFunctionalTestDefaultProviders) {
export default function apmApiIntegrationTests({ loadTestFile }: FtrProviderContext) {
describe('Code', () => {
loadTestFile(require.resolve('./feature_controls'));
loadTestFile(require.resolve('./repo_status'));

View file

@ -5,14 +5,13 @@
*/
import expect from '@kbn/expect';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';
import {
RepoFileStatus,
StatusReport,
} from '../../../../legacy/plugins/code/common/repo_file_status';
// eslint-disable-next-line import/no-default-export
export default function repoStatusTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function repoStatusTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const retry = getService('retry');
const log = getService('log');

View file

@ -5,10 +5,9 @@
*/
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 securityTests({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function securityTests({ getService }: FtrProviderContext) {
const supertest = getService('supertestWithoutAuth');
const security: SecurityService = getService('security');
const spaces: SpacesService = getService('spaces');

View file

@ -4,12 +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 consoleApiIntegrationTests({
loadTestFile,
}: KibanaFunctionalTestDefaultProviders) {
export default function consoleApiIntegrationTests({ loadTestFile }: FtrProviderContext) {
describe('console', () => {
loadTestFile(require.resolve('./feature_controls'));
});

View file

@ -7,7 +7,7 @@
import expect from '@kbn/expect';
import gql from 'graphql-tag';
import { SecurityService, SpacesService } from '../../../common/services';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const introspectionQuery = gql`
query Schema {
@ -19,7 +19,7 @@ const introspectionQuery = gql`
}
`;
const featureControlsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const supertest = getService('supertestWithoutAuth');
const security: SecurityService = getService('security');
const spaces: SpacesService = getService('spaces');
@ -291,7 +291,4 @@ const featureControlsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default featureControlsTests;
}

View file

@ -5,10 +5,10 @@
*/
import expect from '@kbn/expect';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
import { IpToHostResponse } from '../../../../legacy/plugins/infra/server/routes/ip_to_hostname';
const ipToHostNameTest: KbnTestProvider = ({ getService }) => {
export default function ipToHostNameTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
@ -43,7 +43,4 @@ const ipToHostNameTest: KbnTestProvider = ({ getService }) => {
.expect(404);
});
});
};
// eslint-disable-next-line import/no-default-export
export default ipToHostNameTest;
}

View file

@ -11,7 +11,7 @@ import { v4 as uuidv4 } from 'uuid';
import { sharedFragments } from '../../../../legacy/plugins/infra/common/graphql/shared';
import { InfraTimeKey } from '../../../../legacy/plugins/infra/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const KEY_WITHIN_DATA_RANGE = {
time: new Date('2018-10-17T19:50:00.000Z').valueOf(),
@ -88,7 +88,7 @@ const logEntriesBetweenQuery = gql`
${sharedFragments.InfraLogEntryFields}
`;
const logEntriesTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('infraOpsGraphQLClient');
const sourceConfigurationService = getService('infraOpsSourceConfiguration');
@ -333,10 +333,7 @@ const logEntriesTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default logEntriesTests;
}
const isSorted = <Value>(comparator: (first: Value, second: Value) => number) => (
values: Value[]

View file

@ -8,9 +8,9 @@ import expect from '@kbn/expect';
import { ascending, pairs } from 'd3-array';
import gql from 'graphql-tag';
import { FtrProviderContext } from '../../ftr_provider_context';
import { sharedFragments } from '../../../../legacy/plugins/infra/common/graphql/shared';
import { InfraTimeKey } from '../../../../legacy/plugins/infra/public/graphql/types';
import { KbnTestProvider } from './types';
const KEY_BEFORE_START = {
time: new Date('2000-01-01T00:00:00.000Z').valueOf(),
@ -29,7 +29,7 @@ const KEY_AFTER_END = {
tiebreaker: 0,
};
const logEntryHighlightsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('infraOpsGraphQLClient');
@ -238,7 +238,7 @@ const logEntryHighlightsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
}
const logEntryHighlightsQuery = gql`
query LogEntryHighlightsQuery(
@ -273,9 +273,6 @@ const logEntryHighlightsQuery = gql`
${sharedFragments.InfraLogEntryHighlightFields}
`;
// eslint-disable-next-line import/no-default-export
export default logEntryHighlightsTests;
const isSorted = <Value>(comparator: (first: Value, second: Value) => number) => (
values: Value[]
) => pairs(values, comparator).every(order => order <= 0);

View file

@ -7,9 +7,9 @@
import expect from '@kbn/expect';
import { flyoutItemQuery } from '../../../../legacy/plugins/infra/public/containers/logs/flyout_item.gql_query';
import { FlyoutItemQuery } from '../../../../legacy/plugins/infra/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const logItemTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('infraOpsGraphQLClient');
describe('Log Item GraphQL Endpoint', () => {
@ -169,7 +169,4 @@ const logItemTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default logItemTests;
}

View file

@ -8,7 +8,7 @@ import expect from '@kbn/expect';
import { pairs } from 'd3-array';
import gql from 'graphql-tag';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const EARLIEST_TIME_WITH_DATA = new Date('2018-10-17T19:42:22.000Z').valueOf();
const LATEST_TIME_WITH_DATA = new Date('2018-10-17T19:57:21.611Z').valueOf();
@ -41,7 +41,7 @@ const logSummaryBetweenQuery = gql`
}
`;
const logSummaryTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('infraOpsGraphQLClient');
@ -80,7 +80,4 @@ const logSummaryTests: KbnTestProvider = ({ getService }) => {
).to.equal(true);
});
});
};
// eslint-disable-next-line import/no-default-export
export default logSummaryTests;
}

View file

@ -8,9 +8,9 @@ import expect from '@kbn/expect';
import { ascending, pairs } from 'd3-array';
import gql from 'graphql-tag';
import { FtrProviderContext } from '../../ftr_provider_context';
import { sharedFragments } from '../../../../legacy/plugins/infra/common/graphql/shared';
import { InfraTimeKey } from '../../../../legacy/plugins/infra/public/graphql/types';
import { KbnTestProvider } from './types';
const KEY_WITHIN_DATA_RANGE = {
time: new Date('2019-01-06T00:00:00.000Z').valueOf(),
@ -25,7 +25,7 @@ const LATEST_KEY_WITH_DATA = {
tiebreaker: 2,
};
const logsWithoutMillisTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('infraOpsGraphQLClient');
@ -97,10 +97,7 @@ const logsWithoutMillisTests: KbnTestProvider = ({ getService }) => {
).to.have.length(2);
});
});
};
// eslint-disable-next-line import/no-default-export
export default logsWithoutMillisTests;
}
const logEntriesAroundQuery = gql`
query LogEntriesAroundQuery(

View file

@ -10,9 +10,9 @@ import {
InfraMetadata,
InfraMetadataRequest,
} from '../../../../legacy/plugins/infra/common/http_api/metadata_api';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const metadataTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const supertest = getService('supertest');
const fetchMetadata = async (body: InfraMetadataRequest): Promise<InfraMetadata | undefined> => {
@ -241,7 +241,4 @@ const metadataTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default metadataTests;
}

View file

@ -9,12 +9,12 @@ import { first, last } from 'lodash';
import { metricsQuery } from '../../../../legacy/plugins/infra/public/containers/metrics/metrics.gql_query';
import { MetricsQuery } from '../../../../legacy/plugins/infra/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
import { DATES } from './constants';
const { min, max } = DATES['7.0.0'].hosts;
const metricTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('infraOpsGraphQLClient');
@ -75,7 +75,4 @@ const metricTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default metricTests;
}

View file

@ -9,11 +9,11 @@ import { first } from 'lodash';
import moment from 'moment';
import { DATES } from './constants';
import { MetricsExplorerResponse } from '../../../../legacy/plugins/infra/server/routes/metrics_explorer/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const { min, max } = DATES['7.0.0'].hosts;
const metricsExplorerTest: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
@ -259,7 +259,4 @@ const metricsExplorerTest: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default metricsExplorerTest;
}

View file

@ -13,10 +13,10 @@ import {
sourceStatusFieldsFragment,
} from '../../../../legacy/plugins/infra/public/containers/source/source_fields_fragment.gql_query';
import { SourceQuery } from '../../../../legacy/plugins/infra/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
import { sharedFragments } from '../../../../legacy/plugins/infra/common/graphql/shared';
const sourcesTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('infraOpsGraphQLClient');
@ -383,10 +383,7 @@ const sourcesTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default sourcesTests;
}
const createSourceMutation = gql`
mutation createSource($sourceId: ID!, $sourceProperties: UpdateSourceInput!) {

View file

@ -1,43 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloClient } from 'apollo-client';
import {
UpdateSourceInput,
UpdateSourceResult,
} from '../../../../legacy/plugins/infra/public/graphql/types';
export interface EsArchiver {
load(name: string): void;
unload(name: string): void;
}
interface InfraOpsGraphQLClientFactoryOptions {
username: string;
password: string;
basePath: string;
}
interface InfraOpsSourceConfigurationService {
createConfiguration(
sourceId: string,
sourceProperties: UpdateSourceInput
): UpdateSourceResult['source']['version'];
}
export interface KbnTestProviderOptions {
getService(name: string): any;
getService(name: 'esArchiver'): EsArchiver;
getService(name: 'infraOpsGraphQLClient'): ApolloClient<InMemoryCache>;
getService(
name: 'infraOpsGraphQLClientFactory'
): (options: InfraOpsGraphQLClientFactoryOptions) => ApolloClient<InMemoryCache>;
getService(name: 'infraOpsSourceConfiguration'): InfraOpsSourceConfigurationService;
}
export type KbnTestProvider = (options: KbnTestProviderOptions) => void;

View file

@ -9,11 +9,11 @@ import { first, last } from 'lodash';
import { waffleNodesQuery } from '../../../../legacy/plugins/infra/public/containers/waffle/waffle_nodes.gql_query';
import { WaffleNodesQuery } from '../../../../legacy/plugins/infra/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
import { DATES } from './constants';
const waffleTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('infraOpsGraphQLClient');
@ -308,7 +308,4 @@ const waffleTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default waffleTests;
}

View file

@ -7,10 +7,9 @@
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
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: SuperTest<any> = getService('supertestWithoutAuth');
const security: SecurityService = getService('security');
const spaces: SpacesService = getService('spaces');

View file

@ -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({ loadTestFile }: KibanaFunctionalTestDefaultProviders) {
export default function({ loadTestFile }: FtrProviderContext) {
describe('advanced settings', () => {
loadTestFile(require.resolve('./feature_controls'));
});

View file

@ -5,10 +5,9 @@
*/
import expect from '@kbn/expect/expect.js';
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');
describe('Builtin ES Privileges', () => {

View file

@ -5,10 +5,9 @@
*/
import expect from '@kbn/expect/expect.js';
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');
describe('Index Fields', () => {

View file

@ -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({ getService }: KibanaFunctionalTestDefaultProviders) {
export default function({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
let version: string;

View file

@ -6,10 +6,9 @@
import expect from '@kbn/expect';
import { SecurityService } 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');

View file

@ -4,12 +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 shortUrlsApiIntegrationTests({
loadTestFile,
}: KibanaFunctionalTestDefaultProviders) {
export default function shortUrlsApiIntegrationTests({ loadTestFile }: FtrProviderContext) {
describe('Short URLs', () => {
loadTestFile(require.resolve('./feature_controls'));
});

View file

@ -8,7 +8,7 @@ import expect from '@kbn/expect';
import { authenticationsQuery } from '../../../../legacy/plugins/siem/public/containers/authentications/index.gql_query';
import { GetAuthenticationsQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const FROM = new Date('2000-01-01T00:00:00.000Z').valueOf();
const TO = new Date('3000-01-01T00:00:00.000Z').valueOf();
@ -18,7 +18,7 @@ const HOST_NAME = 'zeek-newyork-sha-aa8df15';
const TOTAL_COUNT = 3;
const EDGE_LENGTH = 1;
const authenticationsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -84,7 +84,4 @@ const authenticationsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default authenticationsTests;
}

View file

@ -13,13 +13,13 @@ import {
FlowTarget,
GetDomainsQuery,
} from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const FROM = new Date('2000-01-01T00:00:00.000Z').valueOf();
const TO = new Date('3000-01-01T00:00:00.000Z').valueOf();
const IP = '10.100.7.196';
const domainsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Domains', () => {
@ -138,7 +138,4 @@ const domainsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default domainsTests;
}

View file

@ -14,7 +14,7 @@ import {
GetEventsQuery,
GetLastEventTimeQuery,
} from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const FROM = new Date('2000-01-01T00:00:00.000Z').valueOf();
const TO = new Date('3000-01-01T00:00:00.000Z').valueOf();
@ -24,7 +24,7 @@ const HOST_NAME = 'suricata-sensor-amsterdam';
const TOTAL_COUNT = 1751;
const EDGE_LENGTH = 2;
const eventsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('events API', () => {
@ -344,7 +344,4 @@ const eventsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default eventsTests;
}

View file

@ -7,7 +7,7 @@
import expect from '@kbn/expect';
import gql from 'graphql-tag';
import { SecurityService, SpacesService } from '../../../common/services';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const introspectionQuery = gql`
query Schema {
@ -19,7 +19,7 @@ const introspectionQuery = gql`
}
`;
const featureControlsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const supertest = getService('supertestWithoutAuth');
const security: SecurityService = getService('security');
const spaces: SpacesService = getService('spaces');
@ -237,7 +237,4 @@ const featureControlsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default featureControlsTests;
}

View file

@ -16,7 +16,7 @@ import {
import { HostOverviewQuery } from '../../../../legacy/plugins/siem/public/containers/hosts/overview/host_overview.gql_query';
import { HostFirstLastSeenGqlQuery } from './../../../../legacy/plugins/siem/public/containers/hosts/first_last_seen/first_last_seen.gql_query';
import { HostsTableQuery } from './../../../../legacy/plugins/siem/public/containers/hosts/hosts_table.gql_query';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const FROM = new Date('2000-01-01T00:00:00.000Z').valueOf();
const TO = new Date('3000-01-01T00:00:00.000Z').valueOf();
@ -27,7 +27,7 @@ const TOTAL_COUNT = 7;
const EDGE_LENGTH = 1;
const CURSOR_ID = '2ab45fc1c41e4c84bbd02202a7e5761f';
const hostsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -178,7 +178,4 @@ const hostsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default hostsTests;
}

View file

@ -7,9 +7,9 @@
import expect from '@kbn/expect';
import { ipOverviewQuery } from '../../../../legacy/plugins/siem/public/containers/ip_overview/index.gql_query';
import { GetIpOverviewQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const ipOverviewTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('IP Overview', () => {
@ -64,7 +64,4 @@ const ipOverviewTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default ipOverviewTests;
}

View file

@ -7,9 +7,9 @@
import expect from '@kbn/expect';
import { kpiHostDetailsQuery } from '../../../../legacy/plugins/siem/public/containers/kpi_host_details/index.gql_query';
import { GetKpiHostDetailsQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const kpiHostsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Kpi Host Details', () => {
@ -178,6 +178,4 @@ const kpiHostsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default kpiHostsTests;
}

View file

@ -7,9 +7,9 @@
import expect from '@kbn/expect';
import { kpiHostsQuery } from '../../../../legacy/plugins/siem/public/containers/kpi_hosts/index.gql_query';
import { GetKpiHostsQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const kpiHostsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Kpi Hosts', () => {
@ -222,6 +222,4 @@ const kpiHostsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default kpiHostsTests;
}

View file

@ -7,9 +7,9 @@
import expect from '@kbn/expect';
import { kpiNetworkQuery } from '../../../../legacy/plugins/siem/public/containers/kpi_network/index.gql_query';
import { GetKpiNetworkQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const kpiNetworkTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Kpi Network', () => {
@ -176,7 +176,4 @@ const kpiNetworkTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default kpiNetworkTests;
}

View file

@ -11,9 +11,9 @@ import {
GetNetworkDnsQuery,
NetworkDnsFields,
} from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const networkDnsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Network DNS', () => {
@ -93,7 +93,4 @@ const networkDnsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default networkDnsTests;
}

View file

@ -13,11 +13,11 @@ import {
GetNetworkTopNFlowQuery,
NetworkTopNFlowFields,
} from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const EDGE_LENGTH = 10;
const networkTopNFlowTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Network Top N Flow', () => {
@ -307,7 +307,4 @@ const networkTopNFlowTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default networkTopNFlowTests;
}

View file

@ -7,9 +7,9 @@
import expect from '@kbn/expect';
import { overviewHostQuery } from '../../../../legacy/plugins/siem/public/containers/overview/overview_host/index.gql_query';
import { GetOverviewHostQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const overviewHostTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Overview Host', () => {
@ -53,7 +53,4 @@ const overviewHostTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default overviewHostTests;
}

View file

@ -7,9 +7,9 @@
import expect from '@kbn/expect';
import { overviewNetworkQuery } from '../../../../legacy/plugins/siem/public/containers/overview/overview_network/index.gql_query';
import { GetOverviewNetworkQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const overviewNetworkTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Overview Network', () => {
@ -137,7 +137,4 @@ const overviewNetworkTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default overviewNetworkTests;
}

View file

@ -7,11 +7,10 @@
import expect from '@kbn/expect';
import gql from 'graphql-tag';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { persistTimelineNoteMutation } from '../../../../../legacy/plugins/siem/public/containers/timeline/notes/persist.gql_query';
import { KbnTestProvider } from '../types';
const notesPersistenceTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -94,10 +93,7 @@ const notesPersistenceTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default notesPersistenceTests;
}
const deleteNoteMutation = gql`
mutation DeleteNoteMutation($id: [ID!]!) {

View file

@ -6,11 +6,10 @@
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { persistTimelinePinnedEventMutation } from '../../../../../legacy/plugins/siem/public/containers/timeline/pinned_event/persist.gql_query';
import { KbnTestProvider } from '../types';
const pinnedEventsPersistenceTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -62,7 +61,4 @@ const pinnedEventsPersistenceTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default pinnedEventsPersistenceTests;
}

View file

@ -12,16 +12,15 @@
import expect from '@kbn/expect';
import ApolloClient from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { deleteTimelineMutation } from '../../../../../legacy/plugins/siem/public/containers/timeline/delete/persist.gql_query';
import { persistTimelineFavoriteMutation } from '../../../../../legacy/plugins/siem/public/containers/timeline/favorite/persist.gql_query';
import { persistTimelineMutation } from '../../../../../legacy/plugins/siem/public/containers/timeline/persist.gql_query';
import { TimelineResult } from '../../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from '../types';
const timelinePersistenceTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -296,10 +295,7 @@ const timelinePersistenceTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default timelinePersistenceTests;
}
const omitTypename = (key: string, value: keyof TimelineResult) =>
key === '__typename' ? undefined : value;
@ -307,7 +303,7 @@ const omitTypename = (key: string, value: keyof TimelineResult) =>
const omitTypenameInTimeline = (timeline: TimelineResult) =>
JSON.parse(JSON.stringify(timeline), omitTypename);
const createBasicTimeline = async (client: ApolloClient<InMemoryCache>, titleToSaved: string) =>
const createBasicTimeline = async (client: ApolloClient<any>, titleToSaved: string) =>
await client.mutate<any>({
mutation: persistTimelineMutation,
variables: {

View file

@ -8,9 +8,9 @@ import expect from '@kbn/expect';
import { sourceQuery } from '../../../../legacy/plugins/siem/public/containers/source/index.gql_query';
import { SourceQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const sourcesTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -35,7 +35,4 @@ const sourcesTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default sourcesTests;
}

View file

@ -8,7 +8,7 @@ import expect from '@kbn/expect';
import { timelineQuery } from '../../../../legacy/plugins/siem/public/containers/timeline/index.gql_query';
import { Direction, GetTimelineQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const LTE = new Date('3000-01-01T00:00:00.000Z').valueOf();
const GTE = new Date('2000-01-01T00:00:00.000Z').valueOf();
@ -51,7 +51,7 @@ const FILTER_VALUE = {
},
};
const timelineTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -119,7 +119,4 @@ const timelineTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default timelineTests;
}

View file

@ -12,7 +12,7 @@ import {
DetailItem,
GetTimelineDetailsQuery,
} from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
type DetailsData = Array<
Pick<DetailItem, 'field' | 'values' | 'originalValue'> & {
@ -298,7 +298,7 @@ const EXPECTED_DATA: DetailItem[] = [
{ field: '_score', values: ['1'], originalValue: 1 },
];
const timelineDetailsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -329,7 +329,4 @@ const timelineDetailsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default timelineDetailsTests;
}

View file

@ -12,7 +12,7 @@ import {
FlowTarget,
GetTlsQuery,
} from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const FROM = new Date('2000-01-01T00:00:00.000Z').valueOf();
const TO = new Date('3000-01-01T00:00:00.000Z').valueOf();
@ -29,7 +29,7 @@ const expectedResult = {
notAfter: ['2019-05-22T12:00:00.000Z'],
};
const tlsTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Tls Test', () => {
@ -102,7 +102,4 @@ const tlsTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default tlsTests;
}

View file

@ -1,21 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloClient } from 'apollo-client';
export interface EsArchiver {
load(name: string): void;
unload(name: string): void;
}
export interface KbnTestProviderOptions {
getService(name: string): any;
getService(name: 'esArchiver'): EsArchiver;
getService(name: 'siemGraphQLClient'): ApolloClient<InMemoryCache>;
}
export type KbnTestProvider = (options: KbnTestProviderOptions) => void;

View file

@ -8,7 +8,7 @@ import expect from '@kbn/expect';
import { uncommonProcessesQuery } from '../../../../legacy/plugins/siem/public/containers/uncommon_processes/index.gql_query';
import { GetUncommonProcessesQuery } from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const FROM = new Date('2000-01-01T00:00:00.000Z').valueOf();
const TO = new Date('3000-01-01T00:00:00.000Z').valueOf();
@ -16,7 +16,7 @@ const TO = new Date('3000-01-01T00:00:00.000Z').valueOf();
// typical values that have to change after an update from "scripts/es_archiver"
const TOTAL_COUNT = 80;
const uncommonProcessesTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
@ -160,7 +160,4 @@ const uncommonProcessesTests: KbnTestProvider = ({ getService }) => {
expect(UncommonProcesses.edges[0].node).to.eql(expected);
});
});
};
// eslint-disable-next-line import/no-default-export
export default uncommonProcessesTests;
}

View file

@ -12,13 +12,13 @@ import {
FlowTarget,
GetUsersQuery,
} from '../../../../legacy/plugins/siem/public/graphql/types';
import { KbnTestProvider } from './types';
import { FtrProviderContext } from '../../ftr_provider_context';
const FROM = new Date('2000-01-01T00:00:00.000Z').valueOf();
const TO = new Date('3000-01-01T00:00:00.000Z').valueOf();
const IP = '0.0.0.0';
const usersTests: KbnTestProvider = ({ getService }) => {
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const client = getService('siemGraphQLClient');
describe('Users', () => {
@ -63,7 +63,4 @@ const usersTests: KbnTestProvider = ({ getService }) => {
});
});
});
};
// eslint-disable-next-line import/no-default-export
export default usersTests;
}

View file

@ -3,9 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
// eslint-disable-next-line import/no-default-export
export default function({ loadTestFile }: Record<string, any>) {
export default function({ loadTestFile }: FtrProviderContext) {
describe('spaces', function() {
this.tags('ciGroup6');

View file

@ -5,10 +5,9 @@
*/
import expect from '@kbn/expect/expect.js';
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');
describe('`space` saved object type', () => {

View file

@ -7,11 +7,10 @@
import expect from '@kbn/expect';
import { docCountQueryString } from '../../../../legacy/plugins/uptime/public/queries';
import { SecurityService, SpacesService } from '../../../common/services';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { FtrProviderContext } from '../../ftr_provider_context';
import { PINGS_DATE_RANGE_END, PINGS_DATE_RANGE_START } from './constants';
// 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');

View file

@ -7,9 +7,9 @@
import expect from '@kbn/expect';
import { monitorPageTitleQueryString } from '../../../../../legacy/plugins/uptime/public/queries/monitor_page_title_query';
import monitorPageTitle from './fixtures/monitor_page_title.json';
import { FtrProviderContext } from '../../../ftr_provider_context';
// eslint-disable-next-line import/no-default-export
export default function({ getService }: { getService: any }) {
export default function({ getService }: FtrProviderContext) {
describe('monitorPageTitle', () => {
const supertest = getService('supertest');

View file

@ -6,9 +6,9 @@
import { monitorStatesQueryString } from '../../../../../legacy/plugins/uptime/public/queries/monitor_states_query';
import { expectFixtureEql } from './expect_fixture_eql';
import { FtrProviderContext } from '../../../ftr_provider_context';
// eslint-disable-next-line import/no-default-export
export default function({ getService }: { getService: any }) {
export default function({ getService }: FtrProviderContext) {
describe('monitorStates', () => {
const supertest = getService('supertest');

View file

@ -6,9 +6,9 @@
import { snapshotHistogramQueryString } from '../../../../../legacy/plugins/uptime/public/queries/snapshot_histogram_query';
import { expectFixtureEql } from './expect_fixture_eql';
import { FtrProviderContext } from '../../../ftr_provider_context';
// eslint-disable-next-line import/no-default-export
export default function({ getService }: { getService: any }) {
export default function({ getService }: FtrProviderContext) {
describe('snapshotHistogram', () => {
const supertest = getService('supertest');

View file

@ -7,10 +7,9 @@
import expect from '@kbn/expect';
import { SecurityService } from '../../../../common/services';
import { Feature } from '../../../../../legacy/plugins/xpack_main/types';
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 supertestWithoutAuth = getService('supertestWithoutAuth');

View file

@ -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({ loadTestFile }: KibanaFunctionalTestDefaultProviders) {
export default function({ loadTestFile }: FtrProviderContext) {
describe('Features', () => {
loadTestFile(require.resolve('./features'));
});

View file

@ -5,53 +5,17 @@
*/
import path from 'path';
import {
EsProvider,
EsSupertestWithoutAuthProvider,
SupertestWithoutAuthProvider,
UsageAPIProvider,
InfraOpsGraphQLClientProvider,
InfraOpsGraphQLClientFactoryProvider,
SiemGraphQLClientProvider,
SiemGraphQLClientFactoryProvider,
InfraOpsSourceConfigurationProvider,
} from './services';
import {
SecurityServiceProvider,
SpacesServiceProvider,
} from '../common/services';
import { services } from './services';
import { SLACK_ACTION_SIMULATOR_URI } from './fixtures/plugins/actions';
export async function getApiIntegrationConfig({ readConfigFile }) {
const kibanaAPITestsConfig = await readConfigFile(require.resolve('../../../test/api_integration/config.js'));
const xPackFunctionalTestsConfig = await readConfigFile(require.resolve('../functional/config.js'));
const kibanaCommonConfig = await readConfigFile(require.resolve('../../../test/common/config.js'));
return {
testFiles: [require.resolve('./apis')],
services,
servers: xPackFunctionalTestsConfig.get('servers'),
services: {
supertest: kibanaAPITestsConfig.get('services.supertest'),
esSupertest: kibanaAPITestsConfig.get('services.esSupertest'),
supertestWithoutAuth: SupertestWithoutAuthProvider,
esSupertestWithoutAuth: EsSupertestWithoutAuthProvider,
infraOpsGraphQLClient: InfraOpsGraphQLClientProvider,
infraOpsGraphQLClientFactory: InfraOpsGraphQLClientFactoryProvider,
siemGraphQLClientFactory: SiemGraphQLClientFactoryProvider,
siemGraphQLClient: SiemGraphQLClientProvider,
infraOpsSourceConfiguration: InfraOpsSourceConfigurationProvider,
es: EsProvider,
esArchiver: kibanaCommonConfig.get('services.esArchiver'),
usageAPI: UsageAPIProvider,
kibanaServer: kibanaCommonConfig.get('services.kibanaServer'),
chance: kibanaAPITestsConfig.get('services.chance'),
security: SecurityServiceProvider,
spaces: SpacesServiceProvider,
retry: xPackFunctionalTestsConfig.get('services.retry'),
},
esArchiver: xPackFunctionalTestsConfig.get('esArchiver'),
junit: {
reportName: 'X-Pack API Integration Tests',

View file

@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
import { services } from './services';
export type FtrProviderContext = GenericFtrProviderContext<typeof services, {}>;

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export { EsProvider } from './es';
export { EsSupertestWithoutAuthProvider } from './es_supertest_without_auth';
export { SupertestWithoutAuthProvider } from './supertest_without_auth';
export { UsageAPIProvider } from './usage_api';
export { InfraOpsGraphQLClientProvider, InfraOpsGraphQLClientFactoryProvider } from './infraops_graphql_client';
export { SiemGraphQLClientProvider, SiemGraphQLClientFactoryProvider } from './siem_graphql_client';
export { InfraOpsSourceConfigurationProvider } from './infraops_source_configuration';

View file

@ -0,0 +1,47 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { services as kibanaApiIntegrationServices } from '../../../../test/api_integration/services';
import { services as kibanaCommonServices } from '../../../../test/common/services';
import { SecurityServiceProvider, SpacesServiceProvider } from '../../common/services';
// @ts-ignore not ts yet
import { EsProvider } from './es';
// @ts-ignore not ts yet
import { EsSupertestWithoutAuthProvider } from './es_supertest_without_auth';
// @ts-ignore not ts yet
import { SupertestWithoutAuthProvider } from './supertest_without_auth';
// @ts-ignore not ts yet
import { UsageAPIProvider } from './usage_api';
import {
InfraOpsGraphQLClientProvider,
InfraOpsGraphQLClientFactoryProvider,
} from './infraops_graphql_client';
import { SiemGraphQLClientProvider, SiemGraphQLClientFactoryProvider } from './siem_graphql_client';
import { InfraOpsSourceConfigurationProvider } from './infraops_source_configuration';
export const services = {
chance: kibanaApiIntegrationServices.chance,
esSupertest: kibanaApiIntegrationServices.esSupertest,
supertest: kibanaApiIntegrationServices.supertest,
esArchiver: kibanaCommonServices.esArchiver,
kibanaServer: kibanaCommonServices.kibanaServer,
retry: kibanaCommonServices.retry,
es: EsProvider,
esSupertestWithoutAuth: EsSupertestWithoutAuthProvider,
infraOpsGraphQLClient: InfraOpsGraphQLClientProvider,
infraOpsGraphQLClientFactory: InfraOpsGraphQLClientFactoryProvider,
infraOpsSourceConfiguration: InfraOpsSourceConfigurationProvider,
security: SecurityServiceProvider,
siemGraphQLClient: SiemGraphQLClientProvider,
siemGraphQLClientFactory: SiemGraphQLClientFactoryProvider,
spaces: SpacesServiceProvider,
supertestWithoutAuth: SupertestWithoutAuthProvider,
usageAPI: UsageAPIProvider,
};

View file

@ -10,22 +10,33 @@ import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemo
import { ApolloClient } from 'apollo-client';
import { HttpLink } from 'apollo-link-http';
import { FtrProviderContext } from '../ftr_provider_context';
import introspectionQueryResultData from '../../../legacy/plugins/infra/public/graphql/introspection.json';
export function InfraOpsGraphQLClientProvider({ getService }) {
return new InfraOpsGraphQLClientFactoryProvider({ getService })();
export function InfraOpsGraphQLClientProvider(context: FtrProviderContext) {
return InfraOpsGraphQLClientFactoryProvider(context)();
}
export function InfraOpsGraphQLClientFactoryProvider({ getService }) {
const config = getService('config');
const [superUsername, superPassword] = config.get('servers.elasticsearch.auth').split(':');
interface InfraOpsGraphQLClientFactoryOptions {
username?: string;
password?: string;
basePath?: string;
}
export function InfraOpsGraphQLClientFactoryProvider({ getService }: FtrProviderContext) {
const config = getService('config');
const superAuth: string = config.get('servers.elasticsearch.auth');
const [superUsername, superPassword] = superAuth.split(':');
return function(options?: InfraOpsGraphQLClientFactoryOptions) {
const { username = superUsername, password = superPassword, basePath = null } = options || {};
return function ({ username = superUsername, password = superPassword, basePath = null } = {}) {
const kbnURLWithoutAuth = formatUrl({ ...config.get('servers.kibana'), auth: false });
const httpLink = new HttpLink({
credentials: 'same-origin',
fetch,
fetch: fetch as any,
headers: {
'kbn-xsrf': 'xxx',
authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
@ -41,14 +52,14 @@ export function InfraOpsGraphQLClientFactoryProvider({ getService }) {
}),
defaultOptions: {
query: {
fetchPolicy: 'no-cache'
fetchPolicy: 'no-cache',
},
watchQuery: {
fetchPolicy: 'no-cache'
fetchPolicy: 'no-cache',
},
mutate: {
fetchPolicy: 'no-cache'
},
fetchPolicy: 'no-cache',
} as any,
},
link: httpLink,
});

View file

@ -6,6 +6,12 @@
import gql from 'graphql-tag';
import { FtrProviderContext } from '../ftr_provider_context';
import {
UpdateSourceInput,
UpdateSourceResult,
} from '../../../legacy/plugins/infra/public/graphql/types';
const createSourceMutation = gql`
mutation createSource($sourceId: ID!, $sourceProperties: UpdateSourceInput!) {
createSource(id: $sourceId, sourceProperties: $sourceProperties) {
@ -38,13 +44,18 @@ const createSourceMutation = gql`
}
`;
export function InfraOpsSourceConfigurationProvider({ getService }) {
export function InfraOpsSourceConfigurationProvider({ getService }: FtrProviderContext) {
const client = getService('infraOpsGraphQLClient');
const log = getService('log');
return {
async createConfiguration(sourceId, sourceProperties) {
log.debug(`Creating Infra UI source configuration "${sourceId}" with properties ${JSON.stringify(sourceProperties)}`);
async createConfiguration(sourceId: string, sourceProperties: UpdateSourceInput) {
log.debug(
`Creating Infra UI source configuration "${sourceId}" with properties ${JSON.stringify(
sourceProperties
)}`
);
const response = await client.mutate({
mutation: createSourceMutation,
variables: {
@ -53,7 +64,8 @@ export function InfraOpsSourceConfigurationProvider({ getService }) {
},
});
return response.data.createSource.source.version;
const result: UpdateSourceResult = response.data!.createSource;
return result.source.version;
},
};
}

View file

@ -10,22 +10,32 @@ import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemo
import { ApolloClient } from 'apollo-client';
import { HttpLink } from 'apollo-link-http';
import { FtrProviderContext } from '../ftr_provider_context';
import introspectionQueryResultData from '../../../legacy/plugins/siem/public/graphql/introspection.json';
export function SiemGraphQLClientProvider({ getService }) {
return new SiemGraphQLClientFactoryProvider({ getService })();
interface SiemGraphQLClientFactoryOptions {
username?: string;
password?: string;
basePath?: string;
}
export function SiemGraphQLClientFactoryProvider({ getService }) {
const config = getService('config');
const [superUsername, superPassword] = config.get('servers.elasticsearch.auth').split(':');
export function SiemGraphQLClientProvider(context: FtrProviderContext) {
return SiemGraphQLClientFactoryProvider(context)();
}
export function SiemGraphQLClientFactoryProvider({ getService }: FtrProviderContext) {
const config = getService('config');
const superAuth: string = config.get('servers.elasticsearch.auth');
const [superUsername, superPassword] = superAuth.split(':');
return function(options?: SiemGraphQLClientFactoryOptions) {
const { username = superUsername, password = superPassword, basePath = null } = options || {};
return function ({ username = superUsername, password = superPassword, basePath = null } = {}) {
const kbnURLWithoutAuth = formatUrl({ ...config.get('servers.kibana'), auth: false });
const httpLink = new HttpLink({
credentials: 'same-origin',
fetch,
fetch: fetch as any,
headers: {
'kbn-xsrf': 'xxx',
authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,

View file

@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { format as formatUrl } from 'url';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { LogService } from '../../../types/services';
import { ToolingLog } from '@kbn/dev-utils';
import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
import { Role } from './role';
import { User } from './user';
@ -13,13 +13,13 @@ export class SecurityService {
public role: Role;
public user: User;
constructor(url: string, log: LogService) {
constructor(url: string, log: ToolingLog) {
this.role = new Role(url, log);
this.user = new User(url, log);
}
}
export function SecurityServiceProvider({ getService }: KibanaFunctionalTestDefaultProviders) {
export function SecurityServiceProvider({ getService }: GenericFtrProviderContext<{}, {}>) {
const log = getService('log');
const config = getService('config');
const url = formatUrl(config.get('servers.kibana'));

View file

@ -5,13 +5,13 @@
*/
import axios, { AxiosInstance } from 'axios';
import util from 'util';
import { LogService } from '../../../types/services';
import { ToolingLog } from '@kbn/dev-utils';
export class Role {
private log: LogService;
private log: ToolingLog;
private axios: AxiosInstance;
constructor(url: string, log: LogService) {
constructor(url: string, log: ToolingLog) {
this.log = log;
this.axios = axios.create({
headers: { 'kbn-xsrf': 'x-pack/ftr/services/security/role' },

View file

@ -5,13 +5,13 @@
*/
import axios, { AxiosInstance } from 'axios';
import util from 'util';
import { LogService } from '../../../types/services';
import { ToolingLog } from '@kbn/dev-utils';
export class User {
private log: LogService;
private log: ToolingLog;
private axios: AxiosInstance;
constructor(url: string, log: LogService) {
constructor(url: string, log: ToolingLog) {
this.log = log;
this.axios = axios.create({
headers: { 'kbn-xsrf': 'x-pack/ftr/services/security/user' },

View file

@ -6,14 +6,14 @@
import axios, { AxiosInstance } from 'axios';
import { format as formatUrl } from 'url';
import util from 'util';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
import { LogService } from '../../../types/services';
import { ToolingLog } from '@kbn/dev-utils';
import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
export class SpacesService {
private log: LogService;
private log: ToolingLog;
private axios: AxiosInstance;
constructor(url: string, log: LogService) {
constructor(url: string, log: ToolingLog) {
this.log = log;
this.axios = axios.create({
headers: { 'kbn-xsrf': 'x-pack/ftr/services/spaces/space' },
@ -48,7 +48,7 @@ export class SpacesService {
}
}
export function SpacesServiceProvider({ getService }: KibanaFunctionalTestDefaultProviders) {
export function SpacesServiceProvider({ getService }: GenericFtrProviderContext<{}, {}>) {
const log = getService('log');
const config = getService('config');
const url = formatUrl(config.get('servers.kibana'));

View file

@ -4,10 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
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({ getPageObjects, getService }: KibanaFunctionalTestDefaultProviders) {
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const security = getService('security');
@ -192,7 +191,9 @@ export default function({ getPageObjects, getService }: KibanaFunctionalTestDefa
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
});
await testSubjects.existOrFail('homeApp', 10000);
await testSubjects.existOrFail('homeApp', {
timeout: 10000,
});
});
});
});

View file

@ -5,10 +5,9 @@
*/
import expect from '@kbn/expect';
import { 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({ getPageObjects, getService }: KibanaFunctionalTestDefaultProviders) {
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService: SpacesService = getService('spaces');
const PageObjects = getPageObjects(['common', 'settings', 'security', 'spaceSelector']);
@ -83,7 +82,9 @@ export default function({ getPageObjects, getService }: KibanaFunctionalTestDefa
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
});
await testSubjects.existOrFail('homeApp', 10000);
await testSubjects.existOrFail('homeApp', {
timeout: 10000,
});
});
});
});

View file

@ -4,12 +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 advancedSettingsApp({
loadTestFile,
}: KibanaFunctionalTestDefaultProviders) {
export default function advancedSettingsApp({ loadTestFile }: FtrProviderContext) {
describe('Advanced Settings', function canvasAppTestSuite() {
this.tags(['ciGroup2', 'skipFirefox']); // CI requires tags ヽ(゜Q。)
loadTestFile(require.resolve('./feature_controls/advanced_settings_security'));

View file

@ -5,10 +5,9 @@
*/
import expect from '@kbn/expect';
import { SecurityService } 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({ getPageObjects, getService }: KibanaFunctionalTestDefaultProviders) {
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const security: SecurityService = getService('security');
const PageObjects = getPageObjects(['common', 'error', 'security']);
@ -70,7 +69,9 @@ export default function({ getPageObjects, getService }: KibanaFunctionalTestDefa
it('can navigate to APM app', async () => {
await PageObjects.common.navigateToApp('apm');
await testSubjects.existOrFail('apmMainContainer', 10000);
await testSubjects.existOrFail('apmMainContainer', {
timeout: 10000,
});
});
it(`doesn't show read-only badge`, async () => {
@ -119,7 +120,9 @@ export default function({ getPageObjects, getService }: KibanaFunctionalTestDefa
it('can navigate to APM app', async () => {
await PageObjects.common.navigateToApp('apm');
await testSubjects.existOrFail('apmMainContainer', 10000);
await testSubjects.existOrFail('apmMainContainer', {
timeout: 10000,
});
});
it(`shows read-only badge`, async () => {

Some files were not shown because too many files have changed in this diff Show more