From bc602b1dee1b5cfa8d3d323477ff7ccd2da8ce0e Mon Sep 17 00:00:00 2001 From: kobelb Date: Fri, 7 Sep 2018 13:08:12 -0400 Subject: [PATCH] Moving some tests around --- x-pack/scripts/functional_tests.js | 4 +-- .../common/{config.js => config.ts} | 22 +++++++------ .../common/lib/types.ts | 3 ++ .../apis/{spaces => }/create.ts | 8 ++--- .../apis/{spaces => }/delete.ts | 8 ++--- .../apis/{spaces => }/get.ts | 8 ++--- .../apis/{spaces => }/get_all.ts | 8 ++--- .../security_and_spaces/apis/index.js | 19 ------------ .../security_and_spaces/apis/index.ts | 31 +++++++++++++++++++ .../apis/{spaces => }/select.ts | 24 +++++++------- .../apis/{spaces => }/update.ts | 20 ++++++------ .../{config.js => config.ts} | 1 + .../spaces_only/apis/{spaces => }/create.ts | 6 ++-- .../spaces_only/apis/{spaces => }/delete.ts | 7 +++-- .../spaces_only/apis/{spaces => }/get.ts | 7 +++-- .../spaces_only/apis/{spaces => }/get_all.ts | 7 +++-- .../spaces_only/apis/index.js | 11 ------- .../apis/spaces => spaces_only/apis}/index.ts | 6 ++-- .../spaces_only/apis/{spaces => }/select.ts | 7 +++-- .../spaces_only/apis/spaces/index.ts | 17 ---------- .../spaces_only/apis/{spaces => }/update.ts | 7 +++-- .../spaces_only/{config.js => config.ts} | 3 +- 22 files changed, 116 insertions(+), 118 deletions(-) rename x-pack/test/spaces_api_integration/common/{config.js => config.ts} (84%) rename x-pack/test/spaces_api_integration/security_and_spaces/apis/{spaces => }/create.ts (97%) rename x-pack/test/spaces_api_integration/security_and_spaces/apis/{spaces => }/delete.ts (96%) rename x-pack/test/spaces_api_integration/security_and_spaces/apis/{spaces => }/get.ts (97%) rename x-pack/test/spaces_api_integration/security_and_spaces/apis/{spaces => }/get_all.ts (96%) delete mode 100644 x-pack/test/spaces_api_integration/security_and_spaces/apis/index.js create mode 100644 x-pack/test/spaces_api_integration/security_and_spaces/apis/index.ts rename x-pack/test/spaces_api_integration/security_and_spaces/apis/{spaces => }/select.ts (96%) rename x-pack/test/spaces_api_integration/security_and_spaces/apis/{spaces => }/update.ts (97%) rename x-pack/test/spaces_api_integration/security_and_spaces/{config.js => config.ts} (91%) rename x-pack/test/spaces_api_integration/spaces_only/apis/{spaces => }/create.ts (91%) rename x-pack/test/spaces_api_integration/spaces_only/apis/{spaces => }/delete.ts (83%) rename x-pack/test/spaces_api_integration/spaces_only/apis/{spaces => }/get.ts (88%) rename x-pack/test/spaces_api_integration/spaces_only/apis/{spaces => }/get_all.ts (79%) delete mode 100644 x-pack/test/spaces_api_integration/spaces_only/apis/index.js rename x-pack/test/spaces_api_integration/{security_and_spaces/apis/spaces => spaces_only/apis}/index.ts (75%) rename x-pack/test/spaces_api_integration/spaces_only/apis/{spaces => }/select.ts (88%) delete mode 100644 x-pack/test/spaces_api_integration/spaces_only/apis/spaces/index.ts rename x-pack/test/spaces_api_integration/spaces_only/apis/{spaces => }/update.ts (86%) rename x-pack/test/spaces_api_integration/spaces_only/{config.js => config.ts} (89%) diff --git a/x-pack/scripts/functional_tests.js b/x-pack/scripts/functional_tests.js index c2fa6b051637a..65fa2787c09af 100644 --- a/x-pack/scripts/functional_tests.js +++ b/x-pack/scripts/functional_tests.js @@ -13,8 +13,8 @@ require('@kbn/test').runTestsCli([ require.resolve('../test/functional/config.js'), require.resolve('../test/api_integration/config.js'), require.resolve('../test/saml_api_integration/config.js'), - require.resolve('../test/spaces_api_integration/spaces_only/config.js'), - require.resolve('../test/spaces_api_integration/security_and_spaces/config.js'), + require.resolve('../test/spaces_api_integration/spaces_only/config'), + require.resolve('../test/spaces_api_integration/security_and_spaces/config'), require.resolve('../test/saved_object_api_integration/security_and_spaces/config'), require.resolve('../test/saved_object_api_integration/security_only/config'), require.resolve('../test/saved_object_api_integration/spaces_only/config'), diff --git a/x-pack/test/spaces_api_integration/common/config.js b/x-pack/test/spaces_api_integration/common/config.ts similarity index 84% rename from x-pack/test/spaces_api_integration/common/config.js rename to x-pack/test/spaces_api_integration/common/config.ts index 594891e7ddad7..454951713097d 100644 --- a/x-pack/test/spaces_api_integration/common/config.js +++ b/x-pack/test/spaces_api_integration/common/config.ts @@ -4,26 +4,30 @@ * you may not use this file except in compliance with the Elastic License. */ -import path from 'path'; import { resolveKibanaPath } from '@kbn/plugin-helpers'; +import path from 'path'; +import { TestInvoker } from './lib/types'; import { EsProvider } from './services/es'; +interface CreateTestConfigOptions { + license: string; + disabledPlugins?: [string]; +} -export function createTestConfig(name, { license = 'trial', disabledPlugins = [] } = {}) { - - return async function ({ readConfigFile }) { +export function createTestConfig(name: string, options: CreateTestConfigOptions) { + const { license, disabledPlugins = [] } = options; + return async ({ readConfigFile }: TestInvoker) => { const config = { kibana: { api: await readConfigFile(resolveKibanaPath('test/api_integration/config.js')), - functional: await readConfigFile(require.resolve('../../../../test/functional/config.js')) + functional: await readConfigFile(require.resolve('../../../../test/functional/config.js')), }, xpack: { - api: await readConfigFile(require.resolve('../../api_integration/config.js')) - } + api: await readConfigFile(require.resolve('../../api_integration/config.js')), + }, }; - console.log('resolving', require.resolve(`../${name}/apis/`)); return { testFiles: [require.resolve(`../${name}/apis/`)], servers: config.xpack.api.get('servers'), @@ -40,7 +44,7 @@ export function createTestConfig(name, { license = 'trial', disabledPlugins = [] }, esArchiver: { - directory: path.join(__dirname, 'fixtures', 'es_archiver') + directory: path.join(__dirname, 'fixtures', 'es_archiver'), }, esTestCluster: { diff --git a/x-pack/test/spaces_api_integration/common/lib/types.ts b/x-pack/test/spaces_api_integration/common/lib/types.ts index 1027fdc909632..a58ec39096630 100644 --- a/x-pack/test/spaces_api_integration/common/lib/types.ts +++ b/x-pack/test/spaces_api_integration/common/lib/types.ts @@ -30,7 +30,10 @@ export type LoadTestFileFn = (path: string) => string; export type GetServiceFn = (service: string) => any; +export type ReadConfigFileFn = (path: string) => any; + export interface TestInvoker { getService: GetServiceFn; loadTestFile: LoadTestFileFn; + readConfigFile: ReadConfigFileFn; } diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/create.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/create.ts similarity index 97% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/create.ts rename to x-pack/test/spaces_api_integration/security_and_spaces/apis/create.ts index 1783a44b8f883..21f545256fd3d 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/create.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/create.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { AUTHENTICATION } from '../../../common/lib/authentication'; -import { SPACES } from '../../../common/lib/spaces'; -import { TestInvoker } from '../../../common/lib/types'; -import { createTestSuiteFactory } from '../../../common/suites/spaces/create'; +import { AUTHENTICATION } from '../../common/lib/authentication'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { createTestSuiteFactory } from '../../common/suites/spaces/create'; // tslint:disable:no-default-export export default function createSpacesOnlySuite({ getService }: TestInvoker) { diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/delete.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/delete.ts similarity index 96% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/delete.ts rename to x-pack/test/spaces_api_integration/security_and_spaces/apis/delete.ts index 4b76d42145958..f70400a7d248a 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/delete.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/delete.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { AUTHENTICATION } from '../../../common/lib/authentication'; -import { SPACES } from '../../../common/lib/spaces'; -import { TestInvoker } from '../../../common/lib/types'; -import { deleteTestSuiteFactory } from '../../../common/suites/spaces/delete'; +import { AUTHENTICATION } from '../../common/lib/authentication'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { deleteTestSuiteFactory } from '../../common/suites/spaces/delete'; // tslint:disable:no-default-export export default function deleteSpaceTestSuite({ getService }: TestInvoker) { diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/get.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/get.ts similarity index 97% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/get.ts rename to x-pack/test/spaces_api_integration/security_and_spaces/apis/get.ts index 001a7ab6379ee..ae09edbbf8db3 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/get.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/get.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { AUTHENTICATION } from '../../../common/lib/authentication'; -import { SPACES } from '../../../common/lib/spaces'; -import { TestInvoker } from '../../../common/lib/types'; -import { getTestSuiteFactory } from '../../../common/suites/spaces/get'; +import { AUTHENTICATION } from '../../common/lib/authentication'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { getTestSuiteFactory } from '../../common/suites/spaces/get'; // tslint:disable:no-default-export export default function getSpaceTestSuite({ getService }: TestInvoker) { diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/get_all.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/get_all.ts similarity index 96% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/get_all.ts rename to x-pack/test/spaces_api_integration/security_and_spaces/apis/get_all.ts index 7c60296635b86..86325084591d9 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/get_all.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/get_all.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { AUTHENTICATION } from '../../../common/lib/authentication'; -import { SPACES } from '../../../common/lib/spaces'; -import { TestInvoker } from '../../../common/lib/types'; -import { getAllTestSuiteFactory } from '../../../common/suites/spaces/get_all'; +import { AUTHENTICATION } from '../../common/lib/authentication'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { getAllTestSuiteFactory } from '../../common/suites/spaces/get_all'; // tslint:disable:no-default-export export default function getAllSpacesTestSuite({ getService }: TestInvoker) { diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/index.js b/x-pack/test/spaces_api_integration/security_and_spaces/apis/index.js deleted file mode 100644 index ce8387f9845fc..0000000000000 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/index.js +++ /dev/null @@ -1,19 +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 { createUsersAndRoles } from "../../common/lib/create_users_and_roles"; - -export default function ({ loadTestFile, getService }) { - const es = getService('es'); - const supertest = getService('supertest'); - - describe('apis spaces', () => { - before(async () => { - await createUsersAndRoles(es, supertest); - }); - - loadTestFile(require.resolve('./spaces')); - }); -} diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/index.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/index.ts new file mode 100644 index 0000000000000..0ed0a11a186eb --- /dev/null +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/index.ts @@ -0,0 +1,31 @@ +/* + * 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. + */ +/* + * 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 { createUsersAndRoles } from '../../common/lib/create_users_and_roles'; +import { TestInvoker } from '../../common/lib/types'; + +// tslint:disable:no-default-export +export default function({ loadTestFile, getService }: TestInvoker) { + const es = getService('es'); + const supertest = getService('supertest'); + + describe('apis spaces', () => { + before(async () => { + await createUsersAndRoles(es, supertest); + }); + + loadTestFile(require.resolve('./create')); + loadTestFile(require.resolve('./delete')); + loadTestFile(require.resolve('./get_all')); + loadTestFile(require.resolve('./get')); + loadTestFile(require.resolve('./select')); + loadTestFile(require.resolve('./update')); + }); +} diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/select.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/select.ts similarity index 96% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/select.ts rename to x-pack/test/spaces_api_integration/security_and_spaces/apis/select.ts index e211ea09f20c2..0e40ca405b640 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/select.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/select.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { AUTHENTICATION } from '../../../common/lib/authentication'; -import { SPACES } from '../../../common/lib/spaces'; -import { TestInvoker } from '../../../common/lib/types'; -import { selectTestSuiteFactory } from '../../../common/suites/spaces/select'; +import { AUTHENTICATION } from '../../common/lib/authentication'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { selectTestSuiteFactory } from '../../common/suites/spaces/select'; // tslint:disable:no-default-export export default function selectSpaceTestSuite({ getService }: TestInvoker) { @@ -92,7 +92,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { }); selectTest( - `${scenario.userWithReadGlobally.USERNAME} selects ${scenario.otherSpaceId} from + `${scenario.userWithReadGlobally.USERNAME} selects ${scenario.otherSpaceId} from ${scenario.spaceId}`, { currentSpaceId: scenario.spaceId, @@ -111,7 +111,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `${scenario.userWithDualRead.USERNAME} selects ${scenario.otherSpaceId} from + `${scenario.userWithDualRead.USERNAME} selects ${scenario.otherSpaceId} from ${scenario.spaceId}`, { currentSpaceId: scenario.spaceId, @@ -130,7 +130,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `${scenario.userWithLegacyRead.USERNAME} can select ${scenario.otherSpaceId} + `${scenario.userWithLegacyRead.USERNAME} can select ${scenario.otherSpaceId} from ${scenario.spaceId}`, { currentSpaceId: scenario.spaceId, @@ -165,7 +165,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { }, ].forEach(scenario => { selectTest( - `${scenario.userWithAllAtSpace.USERNAME} can select ${scenario.spaceId} + `${scenario.userWithAllAtSpace.USERNAME} can select ${scenario.spaceId} from ${scenario.spaceId}`, { currentSpaceId: scenario.spaceId, @@ -184,7 +184,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `${scenario.userWithReadAtSpace.USERNAME} can select ${scenario.spaceId} + `${scenario.userWithReadAtSpace.USERNAME} can select ${scenario.spaceId} from ${scenario.spaceId}`, { currentSpaceId: scenario.spaceId, @@ -203,7 +203,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `${scenario.userWithAllAtOtherSpace.USERNAME} cannot select ${scenario.spaceId} + `${scenario.userWithAllAtOtherSpace.USERNAME} cannot select ${scenario.spaceId} from ${scenario.spaceId}`, { currentSpaceId: scenario.spaceId, @@ -233,7 +233,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { }, ].forEach(scenario => { selectTest( - `${scenario.userWithAllAtBothSpaces.USERNAME} can select ${scenario.spaceId} + `${scenario.userWithAllAtBothSpaces.USERNAME} can select ${scenario.spaceId} from ${scenario.otherSpaceId}`, { currentSpaceId: scenario.otherSpaceId, @@ -252,7 +252,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `${scenario.userWithAllAtOtherSpace.USERNAME} cannot select ${scenario.spaceId} + `${scenario.userWithAllAtOtherSpace.USERNAME} cannot select ${scenario.spaceId} from ${scenario.otherSpaceId}`, { currentSpaceId: scenario.otherSpaceId, diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/update.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/update.ts similarity index 97% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/update.ts rename to x-pack/test/spaces_api_integration/security_and_spaces/apis/update.ts index d6597f1fee1f2..124063b0e6c02 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/update.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/update.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { AUTHENTICATION } from '../../../common/lib/authentication'; -import { SPACES } from '../../../common/lib/spaces'; -import { TestInvoker } from '../../../common/lib/types'; -import { updateTestSuiteFactory } from '../../../common/suites/spaces/update'; +import { AUTHENTICATION } from '../../common/lib/authentication'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { updateTestSuiteFactory } from '../../common/suites/spaces/update'; // tslint:disable:no-default-export export default function updateSpaceTestSuite({ getService }: TestInvoker) { @@ -48,7 +48,7 @@ export default function updateSpaceTestSuite({ getService }: TestInvoker) { }, ].forEach(scenario => { updateTest( - `${scenario.userWithAllGlobally.USERNAME} can update space_1 from + `${scenario.userWithAllGlobally.USERNAME} can update space_1 from the ${scenario.spaceId} space`, { spaceId: scenario.spaceId, @@ -88,7 +88,7 @@ export default function updateSpaceTestSuite({ getService }: TestInvoker) { ); updateTest( - `${scenario.userWithDualAll.USERNAME} can update space_1 from + `${scenario.userWithDualAll.USERNAME} can update space_1 from the ${scenario.spaceId} space`, { spaceId: scenario.spaceId, @@ -128,7 +128,7 @@ export default function updateSpaceTestSuite({ getService }: TestInvoker) { ); updateTest( - `${scenario.userWithLegacyAll.USERNAME} can update space_1 from + `${scenario.userWithLegacyAll.USERNAME} can update space_1 from the ${scenario.spaceId} space`, { spaceId: scenario.spaceId, @@ -168,7 +168,7 @@ export default function updateSpaceTestSuite({ getService }: TestInvoker) { ); updateTest( - `${scenario.userWithReadGlobally.USERNAME} cannot update space_1 + `${scenario.userWithReadGlobally.USERNAME} cannot update space_1 from the ${scenario.spaceId} space`, { spaceId: scenario.spaceId, @@ -203,7 +203,7 @@ export default function updateSpaceTestSuite({ getService }: TestInvoker) { ); updateTest( - `${scenario.userWithDualRead.USERNAME} cannot update space_1 + `${scenario.userWithDualRead.USERNAME} cannot update space_1 from the ${scenario.spaceId} space`, { spaceId: scenario.spaceId, @@ -238,7 +238,7 @@ export default function updateSpaceTestSuite({ getService }: TestInvoker) { ); updateTest( - `${scenario.userWithLegacyRead.USERNAME} cannot update space_1 + `${scenario.userWithLegacyRead.USERNAME} cannot update space_1 from the ${scenario.spaceId} space`, { spaceId: scenario.spaceId, diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/config.js b/x-pack/test/spaces_api_integration/security_and_spaces/config.ts similarity index 91% rename from x-pack/test/spaces_api_integration/security_and_spaces/config.js rename to x-pack/test/spaces_api_integration/security_and_spaces/config.ts index 5873a050577d7..81cf9d85671d1 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/config.js +++ b/x-pack/test/spaces_api_integration/security_and_spaces/config.ts @@ -6,4 +6,5 @@ import { createTestConfig } from '../common/config'; +// tslint:disable:no-default-export export default createTestConfig('security_and_spaces', { license: 'trial' }); diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/create.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/create.ts similarity index 91% rename from x-pack/test/spaces_api_integration/spaces_only/apis/spaces/create.ts rename to x-pack/test/spaces_api_integration/spaces_only/apis/create.ts index 3deb0c9aa3892..236225699ecf4 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/create.ts +++ b/x-pack/test/spaces_api_integration/spaces_only/apis/create.ts @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SPACES } from '../../../common/lib/spaces'; -import { TestInvoker } from '../../../common/lib/types'; -import { createTestSuiteFactory } from '../../../common/suites/spaces/create'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { createTestSuiteFactory } from '../../common/suites/spaces/create'; // tslint:disable:no-default-export export default function createSpacesOnlySuite({ getService }: TestInvoker) { diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/delete.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/delete.ts similarity index 83% rename from x-pack/test/spaces_api_integration/spaces_only/apis/spaces/delete.ts rename to x-pack/test/spaces_api_integration/spaces_only/apis/delete.ts index 333b23bd59e91..22a4699337ca8 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/delete.ts +++ b/x-pack/test/spaces_api_integration/spaces_only/apis/delete.ts @@ -4,11 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SPACES } from '../../../common/lib/spaces'; -import { deleteTestSuiteFactory } from '../../../common/suites/spaces/delete'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { deleteTestSuiteFactory } from '../../common/suites/spaces/delete'; // tslint:disable:no-default-export -export default function deleteSpaceTestSuite({ getService }) { +export default function deleteSpaceTestSuite({ getService }: TestInvoker) { const supertestWithoutAuth = getService('supertestWithoutAuth'); const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/get.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/get.ts similarity index 88% rename from x-pack/test/spaces_api_integration/spaces_only/apis/spaces/get.ts rename to x-pack/test/spaces_api_integration/spaces_only/apis/get.ts index 4e547de15e247..c3dbbf5cf30e3 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/get.ts +++ b/x-pack/test/spaces_api_integration/spaces_only/apis/get.ts @@ -4,11 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SPACES } from '../../../common/lib/spaces'; -import { getTestSuiteFactory } from '../../../common/suites/spaces/get'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { getTestSuiteFactory } from '../../common/suites/spaces/get'; // tslint:disable:no-default-export -export default function getSpaceTestSuite({ getService }) { +export default function getSpaceTestSuite({ getService }: TestInvoker) { const supertestWithoutAuth = getService('supertestWithoutAuth'); const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/get_all.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/get_all.ts similarity index 79% rename from x-pack/test/spaces_api_integration/spaces_only/apis/spaces/get_all.ts rename to x-pack/test/spaces_api_integration/spaces_only/apis/get_all.ts index cd11b8045679d..48866fb6f181c 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/get_all.ts +++ b/x-pack/test/spaces_api_integration/spaces_only/apis/get_all.ts @@ -4,11 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SPACES } from '../../../common/lib/spaces'; -import { getAllTestSuiteFactory } from '../../../common/suites/spaces/get_all'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { getAllTestSuiteFactory } from '../../common/suites/spaces/get_all'; // tslint:disable:no-default-export -export default function getAllSpacesTestSuite({ getService }) { +export default function getAllSpacesTestSuite({ getService }: TestInvoker) { const supertestWithoutAuth = getService('supertestWithoutAuth'); const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/index.js b/x-pack/test/spaces_api_integration/spaces_only/apis/index.js deleted file mode 100644 index 21ff2b3ed5eae..0000000000000 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/index.js +++ /dev/null @@ -1,11 +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 default function ({ loadTestFile }) { - describe('apis spaces without security', () => { - loadTestFile(require.resolve('./spaces')); - }); -} diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/index.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/index.ts similarity index 75% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/index.ts rename to x-pack/test/spaces_api_integration/spaces_only/apis/index.ts index 3bf8127d39fb5..6864ee7fbda94 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/spaces/index.ts +++ b/x-pack/test/spaces_api_integration/spaces_only/apis/index.ts @@ -4,11 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import { TestInvoker } from '../../../common/lib/types'; +import { TestInvoker } from '../../common/lib/types'; // tslint:disable:no-default-export -export default function securityWithSpacesTestSuite({ loadTestFile }: TestInvoker) { - describe('spaces', () => { +export default function spacesOnlyTestSuite({ loadTestFile }: TestInvoker) { + describe('spaces api without security', () => { loadTestFile(require.resolve('./create')); loadTestFile(require.resolve('./delete')); loadTestFile(require.resolve('./get_all')); diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/select.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/select.ts similarity index 88% rename from x-pack/test/spaces_api_integration/spaces_only/apis/spaces/select.ts rename to x-pack/test/spaces_api_integration/spaces_only/apis/select.ts index 8de630fa9f7f8..47a8226775241 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/select.ts +++ b/x-pack/test/spaces_api_integration/spaces_only/apis/select.ts @@ -4,11 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SPACES } from '../../../common/lib/spaces'; -import { selectTestSuiteFactory } from '../../../common/suites/spaces/select'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { selectTestSuiteFactory } from '../../common/suites/spaces/select'; // tslint:disable:no-default-export -export default function selectSpaceTestSuite({ getService }) { +export default function selectSpaceTestSuite({ getService }: TestInvoker) { const supertestWithoutAuth = getService('supertestWithoutAuth'); const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/index.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/index.ts deleted file mode 100644 index 08b2e389efd8d..0000000000000 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/index.ts +++ /dev/null @@ -1,17 +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. - */ - -// tslint:disable:no-default-export -export default function spacesOnlyTestSuite({ loadTestFile }) { - describe('spaces', () => { - loadTestFile(require.resolve('./create')); - loadTestFile(require.resolve('./delete')); - loadTestFile(require.resolve('./get_all')); - loadTestFile(require.resolve('./get')); - loadTestFile(require.resolve('./select')); - loadTestFile(require.resolve('./update')); - }); -} diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/update.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/update.ts similarity index 86% rename from x-pack/test/spaces_api_integration/spaces_only/apis/spaces/update.ts rename to x-pack/test/spaces_api_integration/spaces_only/apis/update.ts index d3426a0a816fa..48f7ea3533b6e 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/spaces/update.ts +++ b/x-pack/test/spaces_api_integration/spaces_only/apis/update.ts @@ -4,11 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SPACES } from '../../../common/lib/spaces'; -import { updateTestSuiteFactory } from '../../../common/suites/spaces/update'; +import { SPACES } from '../../common/lib/spaces'; +import { TestInvoker } from '../../common/lib/types'; +import { updateTestSuiteFactory } from '../../common/suites/spaces/update'; // tslint:disable:no-default-export -export default function updateSpaceTestSuite({ getService }) { +export default function updateSpaceTestSuite({ getService }: TestInvoker) { const supertestWithoutAuth = getService('supertestWithoutAuth'); const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/spaces_api_integration/spaces_only/config.js b/x-pack/test/spaces_api_integration/spaces_only/config.ts similarity index 89% rename from x-pack/test/spaces_api_integration/spaces_only/config.js rename to x-pack/test/spaces_api_integration/spaces_only/config.ts index 4b80c979ffdf0..49e31da77dd74 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/config.js +++ b/x-pack/test/spaces_api_integration/spaces_only/config.ts @@ -5,4 +5,5 @@ */ import { createTestConfig } from '../common/config'; -export default createTestConfig('spaces_only', { license: 'basic', securityEnabled: false }); +// tslint:disable:no-default-export +export default createTestConfig('spaces_only', { license: 'basic' });