Rename resolve import conflicts API to resolve import errors (#33024)
This commit is contained in:
parent
c68a45f751
commit
772d0d71c8
19 changed files with 122 additions and 128 deletions
|
@ -20,7 +20,7 @@ NOTE: You cannot access these endpoints via the Console in Kibana.
|
|||
* <<saved-objects-api-delete>>
|
||||
* <<saved-objects-api-export>>
|
||||
* <<saved-objects-api-import>>
|
||||
* <<saved-objects-api-resolve-import-conflicts>>
|
||||
* <<saved-objects-api-resolve-import-errors>>
|
||||
|
||||
include::saved-objects/get.asciidoc[]
|
||||
include::saved-objects/bulk_get.asciidoc[]
|
||||
|
@ -31,4 +31,4 @@ include::saved-objects/update.asciidoc[]
|
|||
include::saved-objects/delete.asciidoc[]
|
||||
include::saved-objects/export.asciidoc[]
|
||||
include::saved-objects/import.asciidoc[]
|
||||
include::saved-objects/resolve_import_conflicts.asciidoc[]
|
||||
include::saved-objects/resolve_import_errors.asciidoc[]
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
[[saved-objects-api-resolve-import-conflicts]]
|
||||
=== Resolve Import Conflicts
|
||||
[[saved-objects-api-resolve-import-errors]]
|
||||
=== Resolve Import Errors
|
||||
|
||||
experimental[This functionality is *experimental* and may be changed or removed completely in a future release.]
|
||||
|
||||
The resolve import conflicts API enables you to resolve conflicts given by the import API by either overwriting specific saved objects or changing references to a newly created object.
|
||||
The resolve import errors API enables you to resolve errors given by the import API by either overwriting specific saved objects or changing references to a newly created object.
|
||||
|
||||
Note: You cannot access this endpoint via the Console in Kibana.
|
||||
|
||||
==== Request
|
||||
|
||||
`POST /api/saved_objects/_resolve_import_conflicts`
|
||||
`POST /api/saved_objects/_resolve_import_errors`
|
||||
|
||||
==== Request body
|
||||
|
||||
|
@ -35,12 +35,12 @@ In the scenario the import wasn't successful a top level `errors` array will con
|
|||
|
||||
==== Examples
|
||||
|
||||
The following example resolves conflicts for an index pattern and dashboard but indicates to skip the index pattern.
|
||||
The following example resolves errors for an index pattern and dashboard but indicates to skip the index pattern.
|
||||
This will cause the index pattern to not be in the system and the dashboard to overwrite the existing saved object.
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST api/saved_objects/_resolve_import_conflicts
|
||||
POST api/saved_objects/_resolve_import_errors
|
||||
Content-Type: multipart/form-data; boundary=EXAMPLE
|
||||
--EXAMPLE
|
||||
Content-Disposition: form-data; name="file"; filename="export.ndjson"
|
||||
|
@ -71,12 +71,12 @@ containing a JSON structure similar to the following example:
|
|||
}
|
||||
--------------------------------------------------
|
||||
|
||||
The following example resolves conflicts for a visualization and dashboard but indicates
|
||||
The following example resolves errors for a visualization and dashboard but indicates
|
||||
to replace the dashboard references to another visualization.
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST api/saved_objects/_resolve_import_conflicts
|
||||
POST api/saved_objects/_resolve_import_errors
|
||||
Content-Type: multipart/form-data; boundary=EXAMPLE
|
||||
--EXAMPLE
|
||||
Content-Disposition: form-data; name="file"; filename="export.ndjson"
|
|
@ -18,4 +18,4 @@
|
|||
*/
|
||||
|
||||
export { importSavedObjects } from './import_saved_objects';
|
||||
export { resolveImportConflicts } from './resolve_import_conflicts';
|
||||
export { resolveImportErrors } from './resolve_import_errors';
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
import { Readable } from 'stream';
|
||||
import { SavedObject } from '../service';
|
||||
import { resolveImportConflicts } from './resolve_import_conflicts';
|
||||
import { resolveImportErrors } from './resolve_import_errors';
|
||||
|
||||
describe('resolveImportConflicts()', () => {
|
||||
describe('resolveImportErrors()', () => {
|
||||
const savedObjects: SavedObject[] = [
|
||||
{
|
||||
id: '1',
|
||||
|
@ -85,7 +85,7 @@ describe('resolveImportConflicts()', () => {
|
|||
savedObjectsClient.bulkCreate.mockResolvedValue({
|
||||
saved_objects: savedObjects,
|
||||
});
|
||||
const result = await resolveImportConflicts({
|
||||
const result = await resolveImportErrors({
|
||||
readStream,
|
||||
objectLimit: 4,
|
||||
skips: [],
|
||||
|
@ -112,7 +112,7 @@ Object {
|
|||
savedObjectsClient.bulkCreate.mockResolvedValue({
|
||||
saved_objects: savedObjects,
|
||||
});
|
||||
const result = await resolveImportConflicts({
|
||||
const result = await resolveImportErrors({
|
||||
readStream,
|
||||
objectLimit: 4,
|
||||
skips: [
|
||||
|
@ -150,7 +150,7 @@ Object {
|
|||
savedObjectsClient.bulkCreate.mockResolvedValue({
|
||||
saved_objects: savedObjects,
|
||||
});
|
||||
const result = await resolveImportConflicts({
|
||||
const result = await resolveImportErrors({
|
||||
readStream,
|
||||
objectLimit: 4,
|
||||
skips: [],
|
||||
|
@ -206,7 +206,7 @@ Object {
|
|||
savedObjectsClient.bulkCreate.mockResolvedValue({
|
||||
saved_objects: savedObjects,
|
||||
});
|
||||
const result = await resolveImportConflicts({
|
||||
const result = await resolveImportErrors({
|
||||
readStream,
|
||||
objectLimit: 4,
|
||||
skips: [],
|
|
@ -23,7 +23,7 @@ import { collectSavedObjects } from './collect_saved_objects';
|
|||
import { createObjectsFilter } from './create_objects_filter';
|
||||
import { CustomError, extractErrors } from './extract_errors';
|
||||
|
||||
interface ResolveImportConflictsOptions {
|
||||
interface ResolveImportErrorsOptions {
|
||||
readStream: Readable;
|
||||
objectLimit: number;
|
||||
savedObjectsClient: SavedObjectsClient;
|
||||
|
@ -48,14 +48,14 @@ interface ImportResponse {
|
|||
errors?: CustomError[];
|
||||
}
|
||||
|
||||
export async function resolveImportConflicts({
|
||||
export async function resolveImportErrors({
|
||||
readStream,
|
||||
objectLimit,
|
||||
skips,
|
||||
overwrites,
|
||||
savedObjectsClient,
|
||||
replaceReferences,
|
||||
}: ResolveImportConflictsOptions): Promise<ImportResponse> {
|
||||
}: ResolveImportErrorsOptions): Promise<ImportResponse> {
|
||||
let errors: CustomError[] = [];
|
||||
const filter = createObjectsFilter(skips, overwrites, replaceReferences);
|
||||
const objectsToResolve = await collectSavedObjects(readStream, objectLimit, filter);
|
|
@ -24,6 +24,6 @@ export { createDeleteRoute } from './delete';
|
|||
export { createFindRoute } from './find';
|
||||
export { createGetRoute } from './get';
|
||||
export { createImportRoute } from './import';
|
||||
export { createResolveImportConflictsRoute } from './resolve_import_conflicts';
|
||||
export { createResolveImportErrorsRoute } from './resolve_import_errors';
|
||||
export { createUpdateRoute } from './update';
|
||||
export { createExportRoute } from './export';
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
import Hapi from 'hapi';
|
||||
import { createMockServer } from './_mock_server';
|
||||
import { createResolveImportConflictsRoute } from './resolve_import_conflicts';
|
||||
import { createResolveImportErrorsRoute } from './resolve_import_errors';
|
||||
|
||||
describe('POST /api/saved_objects/_resolve_import_conflicts', () => {
|
||||
describe('POST /api/saved_objects/_resolve_import_errors', () => {
|
||||
let server: Hapi.Server;
|
||||
const savedObjectsClient = {
|
||||
errors: {} as any,
|
||||
|
@ -53,13 +53,13 @@ describe('POST /api/saved_objects/_resolve_import_conflicts', () => {
|
|||
},
|
||||
};
|
||||
|
||||
server.route(createResolveImportConflictsRoute(prereqs, server));
|
||||
server.route(createResolveImportErrorsRoute(prereqs, server));
|
||||
});
|
||||
|
||||
test('formats successful response', async () => {
|
||||
const request = {
|
||||
method: 'POST',
|
||||
url: '/api/saved_objects/_resolve_import_conflicts',
|
||||
url: '/api/saved_objects/_resolve_import_errors',
|
||||
payload: [
|
||||
'--BOUNDARY',
|
||||
'Content-Disposition: form-data; name="file"; filename="export.ndjson"',
|
||||
|
@ -83,7 +83,7 @@ describe('POST /api/saved_objects/_resolve_import_conflicts', () => {
|
|||
// NOTE: changes to this scenario should be reflected in the docs
|
||||
const request = {
|
||||
method: 'POST',
|
||||
url: '/api/saved_objects/_resolve_import_conflicts',
|
||||
url: '/api/saved_objects/_resolve_import_errors',
|
||||
payload: [
|
||||
'--EXAMPLE',
|
||||
'Content-Disposition: form-data; name="file"; filename="export.ndjson"',
|
||||
|
@ -152,7 +152,7 @@ describe('POST /api/saved_objects/_resolve_import_conflicts', () => {
|
|||
// NOTE: changes to this scenario should be reflected in the docs
|
||||
const request = {
|
||||
method: 'POST',
|
||||
url: '/api/saved_objects/_resolve_import_conflicts',
|
||||
url: '/api/saved_objects/_resolve_import_errors',
|
||||
payload: [
|
||||
'--EXAMPLE',
|
||||
'Content-Disposition: form-data; name="file"; filename="export.ndjson"',
|
|
@ -23,7 +23,7 @@ import Joi from 'joi';
|
|||
import { extname } from 'path';
|
||||
import { Readable } from 'stream';
|
||||
import { SavedObjectsClient } from '../';
|
||||
import { resolveImportConflicts } from '../import';
|
||||
import { resolveImportErrors } from '../import';
|
||||
import { Prerequisites } from './types';
|
||||
|
||||
interface HapiReadableStream extends Readable {
|
||||
|
@ -54,8 +54,8 @@ interface ImportRequest extends Hapi.Request {
|
|||
};
|
||||
}
|
||||
|
||||
export const createResolveImportConflictsRoute = (prereqs: Prerequisites, server: Hapi.Server) => ({
|
||||
path: '/api/saved_objects/_resolve_import_conflicts',
|
||||
export const createResolveImportErrorsRoute = (prereqs: Prerequisites, server: Hapi.Server) => ({
|
||||
path: '/api/saved_objects/_resolve_import_errors',
|
||||
method: 'POST',
|
||||
config: {
|
||||
pre: [prereqs.getSavedObjectsClient],
|
||||
|
@ -102,7 +102,7 @@ export const createResolveImportConflictsRoute = (prereqs: Prerequisites, server
|
|||
if (fileExtension !== '.ndjson') {
|
||||
return Boom.badRequest(`Invalid file extension ${fileExtension}`);
|
||||
}
|
||||
return await resolveImportConflicts({
|
||||
return await resolveImportErrors({
|
||||
savedObjectsClient,
|
||||
readStream: request.payload.file,
|
||||
objectLimit: request.server.config().get('savedObjects.maxImportExportSize'),
|
|
@ -33,7 +33,7 @@ import {
|
|||
createUpdateRoute,
|
||||
createExportRoute,
|
||||
createImportRoute,
|
||||
createResolveImportConflictsRoute,
|
||||
createResolveImportErrorsRoute,
|
||||
} from './routes';
|
||||
|
||||
export function savedObjectsMixin(kbnServer, server) {
|
||||
|
@ -66,7 +66,7 @@ export function savedObjectsMixin(kbnServer, server) {
|
|||
server.route(createUpdateRoute(prereqs));
|
||||
server.route(createExportRoute(prereqs, server));
|
||||
server.route(createImportRoute(prereqs, server));
|
||||
server.route(createResolveImportConflictsRoute(prereqs, server));
|
||||
server.route(createResolveImportErrorsRoute(prereqs, server));
|
||||
|
||||
const schema = new SavedObjectsSchema(kbnServer.uiExports.savedObjectSchemas);
|
||||
const serializer = new SavedObjectsSerializer(schema);
|
||||
|
|
|
@ -142,10 +142,10 @@ describe('Saved Objects Mixin', () => {
|
|||
savedObjectsMixin(mockKbnServer, mockServer);
|
||||
expect(mockServer.route).toHaveBeenCalledWith(expect.objectContaining({ path: '/api/saved_objects/_import', method: 'POST' }));
|
||||
});
|
||||
it('should add POST /api/saved_objects/_resolve_import_conflicts', () => {
|
||||
it('should add POST /api/saved_objects/_resolve_import_errors', () => {
|
||||
savedObjectsMixin(mockKbnServer, mockServer);
|
||||
expect(mockServer.route)
|
||||
.toHaveBeenCalledWith(expect.objectContaining({ path: '/api/saved_objects/_resolve_import_conflicts', method: 'POST' }));
|
||||
.toHaveBeenCalledWith(expect.objectContaining({ path: '/api/saved_objects/_resolve_import_errors', method: 'POST' }));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ export default function ({ loadTestFile }) {
|
|||
loadTestFile(require.resolve('./find'));
|
||||
loadTestFile(require.resolve('./get'));
|
||||
loadTestFile(require.resolve('./import'));
|
||||
loadTestFile(require.resolve('./resolve_import_conflicts'));
|
||||
loadTestFile(require.resolve('./resolve_import_errors'));
|
||||
loadTestFile(require.resolve('./update'));
|
||||
loadTestFile(require.resolve('./migrations'));
|
||||
});
|
||||
|
|
|
@ -24,14 +24,14 @@ export default function ({ getService }) {
|
|||
const supertest = getService('supertest');
|
||||
const esArchiver = getService('esArchiver');
|
||||
|
||||
describe('resolve_import_conflicts', () => {
|
||||
describe('resolve_import_errors', () => {
|
||||
describe('without kibana index', () => {
|
||||
// Cleanup data that got created in import
|
||||
after(() => esArchiver.unload('saved_objects/basic'));
|
||||
|
||||
it('should return 200 and import nothing when empty parameters are passed in', async () => {
|
||||
await supertest
|
||||
.post('/api/saved_objects/_resolve_import_conflicts')
|
||||
.post('/api/saved_objects/_resolve_import_errors')
|
||||
.attach('file', join(__dirname, '../../fixtures/import.ndjson'))
|
||||
.expect(200)
|
||||
.then((resp) => {
|
||||
|
@ -44,7 +44,7 @@ export default function ({ getService }) {
|
|||
|
||||
it('should return 200 and import everything when overwrite parameters contains all objects', async () => {
|
||||
await supertest
|
||||
.post('/api/saved_objects/_resolve_import_conflicts')
|
||||
.post('/api/saved_objects/_resolve_import_errors')
|
||||
.field('overwrites', JSON.stringify([
|
||||
{
|
||||
type: 'index-pattern',
|
||||
|
@ -71,7 +71,7 @@ export default function ({ getService }) {
|
|||
|
||||
it('should return 400 when no file passed in', async () => {
|
||||
await supertest
|
||||
.post('/api/saved_objects/_resolve_import_conflicts')
|
||||
.post('/api/saved_objects/_resolve_import_errors')
|
||||
.field('skips', '[]')
|
||||
.expect(400)
|
||||
.then((resp) => {
|
||||
|
@ -100,7 +100,7 @@ export default function ({ getService }) {
|
|||
]
|
||||
};
|
||||
await supertest
|
||||
.post('/api/saved_objects/_resolve_import_conflicts')
|
||||
.post('/api/saved_objects/_resolve_import_errors')
|
||||
.field('replaceReferences', JSON.stringify(
|
||||
[
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ export default function ({ getService }) {
|
|||
fileChunks.push(`{"type":"visualization","id":"${i}","attributes":{},"references":[]}`);
|
||||
}
|
||||
await supertest
|
||||
.post('/api/saved_objects/_resolve_import_conflicts')
|
||||
.post('/api/saved_objects/_resolve_import_errors')
|
||||
.attach('file', Buffer.from(fileChunks.join('\n'), 'utf8'), 'export.ndjson')
|
||||
.expect(400)
|
||||
.then((resp) => {
|
||||
|
@ -158,7 +158,7 @@ export default function ({ getService }) {
|
|||
|
||||
it('should return 200 when skipping all the records', async () => {
|
||||
await supertest
|
||||
.post('/api/saved_objects/_resolve_import_conflicts')
|
||||
.post('/api/saved_objects/_resolve_import_errors')
|
||||
.field('skips', JSON.stringify(
|
||||
[
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ export default function ({ getService }) {
|
|||
|
||||
it('should return 200 when manually overwriting each object', async () => {
|
||||
await supertest
|
||||
.post('/api/saved_objects/_resolve_import_conflicts')
|
||||
.post('/api/saved_objects/_resolve_import_errors')
|
||||
.field('overwrites', JSON.stringify(
|
||||
[
|
||||
{
|
||||
|
@ -210,7 +210,7 @@ export default function ({ getService }) {
|
|||
|
||||
it('should return 200 with only one record when overwriting 1 and skipping 1', async () => {
|
||||
await supertest
|
||||
.post('/api/saved_objects/_resolve_import_conflicts')
|
||||
.post('/api/saved_objects/_resolve_import_errors')
|
||||
.field('overwrites', JSON.stringify(
|
||||
[
|
||||
{
|
|
@ -10,20 +10,20 @@ import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
|
|||
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
|
||||
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
|
||||
|
||||
interface ResolveImportConflictsTest {
|
||||
interface ResolveImportErrorsTest {
|
||||
statusCode: number;
|
||||
response: (resp: { [key: string]: any }) => void;
|
||||
}
|
||||
|
||||
interface ResolveImportConflictsTests {
|
||||
default: ResolveImportConflictsTest;
|
||||
unknownType: ResolveImportConflictsTest;
|
||||
interface ResolveImportErrorsTests {
|
||||
default: ResolveImportErrorsTest;
|
||||
unknownType: ResolveImportErrorsTest;
|
||||
}
|
||||
|
||||
interface ResolveImportConflictsTestDefinition {
|
||||
interface ResolveImportErrorsTestDefinition {
|
||||
user?: TestDefinitionAuthentication;
|
||||
spaceId?: string;
|
||||
tests: ResolveImportConflictsTests;
|
||||
tests: ResolveImportErrorsTests;
|
||||
}
|
||||
|
||||
const createImportData = (spaceId: string) => [
|
||||
|
@ -43,7 +43,7 @@ const createImportData = (spaceId: string) => [
|
|||
},
|
||||
];
|
||||
|
||||
export function resolveImportConflictsTestSuiteFactory(
|
||||
export function resolveImportErrorsTestSuiteFactory(
|
||||
es: any,
|
||||
esArchiver: any,
|
||||
supertest: SuperTest<any>
|
||||
|
@ -99,9 +99,9 @@ export function resolveImportConflictsTestSuiteFactory(
|
|||
});
|
||||
};
|
||||
|
||||
const makeResolveImportConflictsTest = (describeFn: DescribeFn) => (
|
||||
const makeResolveImportErrorsTest = (describeFn: DescribeFn) => (
|
||||
description: string,
|
||||
definition: ResolveImportConflictsTestDefinition
|
||||
definition: ResolveImportErrorsTestDefinition
|
||||
) => {
|
||||
const { user = {}, spaceId = DEFAULT_SPACE_ID, tests } = definition;
|
||||
|
||||
|
@ -112,7 +112,7 @@ export function resolveImportConflictsTestSuiteFactory(
|
|||
it(`should return ${tests.default.statusCode}`, async () => {
|
||||
const data = createImportData(spaceId);
|
||||
await supertest
|
||||
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_resolve_import_conflicts`)
|
||||
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_resolve_import_errors`)
|
||||
.auth(user.username, user.password)
|
||||
.field(
|
||||
'overwrites',
|
||||
|
@ -143,7 +143,7 @@ export function resolveImportConflictsTestSuiteFactory(
|
|||
},
|
||||
});
|
||||
await supertest
|
||||
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_resolve_import_conflicts`)
|
||||
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_resolve_import_errors`)
|
||||
.auth(user.username, user.password)
|
||||
.field(
|
||||
'overwrites',
|
||||
|
@ -170,12 +170,12 @@ export function resolveImportConflictsTestSuiteFactory(
|
|||
});
|
||||
};
|
||||
|
||||
const resolveImportConflictsTest = makeResolveImportConflictsTest(describe);
|
||||
const resolveImportErrorsTest = makeResolveImportErrorsTest(describe);
|
||||
// @ts-ignore
|
||||
resolveImportConflictsTest.only = makeResolveImportConflictsTest(describe.only);
|
||||
resolveImportErrorsTest.only = makeResolveImportErrorsTest(describe.only);
|
||||
|
||||
return {
|
||||
resolveImportConflictsTest,
|
||||
resolveImportErrorsTest,
|
||||
createExpectResults,
|
||||
expectRbacForbidden,
|
||||
expectUnknownType,
|
|
@ -27,7 +27,7 @@ export default function({ getService, loadTestFile }: TestInvoker) {
|
|||
loadTestFile(require.resolve('./find'));
|
||||
loadTestFile(require.resolve('./get'));
|
||||
loadTestFile(require.resolve('./import'));
|
||||
loadTestFile(require.resolve('./resolve_import_conflicts'));
|
||||
loadTestFile(require.resolve('./resolve_import_errors'));
|
||||
loadTestFile(require.resolve('./update'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { AUTHENTICATION } from '../../common/lib/authentication';
|
||||
import { SPACES } from '../../common/lib/spaces';
|
||||
import { TestInvoker } from '../../common/lib/types';
|
||||
import { resolveImportConflictsTestSuiteFactory } from '../../common/suites/resolve_import_conflicts';
|
||||
import { resolveImportErrorsTestSuiteFactory } from '../../common/suites/resolve_import_errors';
|
||||
|
||||
// tslint:disable:no-default-export
|
||||
export default function({ getService }: TestInvoker) {
|
||||
|
@ -16,15 +16,15 @@ export default function({ getService }: TestInvoker) {
|
|||
const es = getService('es');
|
||||
|
||||
const {
|
||||
resolveImportConflictsTest,
|
||||
resolveImportErrorsTest,
|
||||
createExpectResults,
|
||||
expectRbacForbidden,
|
||||
expectUnknownType,
|
||||
expectRbacForbiddenWithUnknownType,
|
||||
expectRbacForbiddenForUnknownType,
|
||||
} = resolveImportConflictsTestSuiteFactory(es, esArchiver, supertest);
|
||||
} = resolveImportErrorsTestSuiteFactory(es, esArchiver, supertest);
|
||||
|
||||
describe('_resolve_import_conflicts', () => {
|
||||
describe('_resolve_import_errors', () => {
|
||||
[
|
||||
{
|
||||
spaceId: SPACES.DEFAULT.spaceId,
|
||||
|
@ -57,7 +57,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
},
|
||||
].forEach(scenario => {
|
||||
resolveImportConflictsTest(`user with no access within the ${scenario.spaceId} space`, {
|
||||
resolveImportErrorsTest(`user with no access within the ${scenario.spaceId} space`, {
|
||||
user: scenario.users.noAccess,
|
||||
spaceId: scenario.spaceId,
|
||||
tests: {
|
||||
|
@ -72,7 +72,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`superuser within the ${scenario.spaceId} space`, {
|
||||
resolveImportErrorsTest(`superuser within the ${scenario.spaceId} space`, {
|
||||
user: scenario.users.superuser,
|
||||
spaceId: scenario.spaceId,
|
||||
tests: {
|
||||
|
@ -87,7 +87,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`legacy user within the ${scenario.spaceId} space`, {
|
||||
resolveImportErrorsTest(`legacy user within the ${scenario.spaceId} space`, {
|
||||
user: scenario.users.legacyAll,
|
||||
spaceId: scenario.spaceId,
|
||||
tests: {
|
||||
|
@ -102,7 +102,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`dual-privileges user within the ${scenario.spaceId} space`, {
|
||||
resolveImportErrorsTest(`dual-privileges user within the ${scenario.spaceId} space`, {
|
||||
user: scenario.users.dualAll,
|
||||
spaceId: scenario.spaceId,
|
||||
tests: {
|
||||
|
@ -117,7 +117,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(
|
||||
resolveImportErrorsTest(
|
||||
`dual-privileges readonly user within the ${scenario.spaceId} space`,
|
||||
{
|
||||
user: scenario.users.dualRead,
|
||||
|
@ -135,9 +135,7 @@ export default function({ getService }: TestInvoker) {
|
|||
}
|
||||
);
|
||||
|
||||
resolveImportConflictsTest(
|
||||
`rbac user with all globally within the ${scenario.spaceId} space`,
|
||||
{
|
||||
resolveImportErrorsTest(`rbac user with all globally within the ${scenario.spaceId} space`, {
|
||||
user: scenario.users.allGlobally,
|
||||
spaceId: scenario.spaceId,
|
||||
tests: {
|
||||
|
@ -150,12 +148,9 @@ export default function({ getService }: TestInvoker) {
|
|||
response: expectRbacForbiddenForUnknownType,
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(
|
||||
`rbac user with read globally within the ${scenario.spaceId} space`,
|
||||
{
|
||||
resolveImportErrorsTest(`rbac user with read globally within the ${scenario.spaceId} space`, {
|
||||
user: scenario.users.readGlobally,
|
||||
spaceId: scenario.spaceId,
|
||||
tests: {
|
||||
|
@ -168,10 +163,9 @@ export default function({ getService }: TestInvoker) {
|
|||
response: expectRbacForbiddenWithUnknownType,
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(
|
||||
resolveImportErrorsTest(
|
||||
`rbac user with all at the space within the ${scenario.spaceId} space`,
|
||||
{
|
||||
user: scenario.users.allAtSpace,
|
||||
|
@ -189,7 +183,7 @@ export default function({ getService }: TestInvoker) {
|
|||
}
|
||||
);
|
||||
|
||||
resolveImportConflictsTest(
|
||||
resolveImportErrorsTest(
|
||||
`rbac user with read at the space within the ${scenario.spaceId} space`,
|
||||
{
|
||||
user: scenario.users.readAtSpace,
|
||||
|
@ -207,7 +201,7 @@ export default function({ getService }: TestInvoker) {
|
|||
}
|
||||
);
|
||||
|
||||
resolveImportConflictsTest(
|
||||
resolveImportErrorsTest(
|
||||
`rbac user with all at other space within the ${scenario.spaceId} space`,
|
||||
{
|
||||
user: scenario.users.allAtOtherSpace,
|
|
@ -27,7 +27,7 @@ export default function({ getService, loadTestFile }: TestInvoker) {
|
|||
loadTestFile(require.resolve('./find'));
|
||||
loadTestFile(require.resolve('./get'));
|
||||
loadTestFile(require.resolve('./import'));
|
||||
loadTestFile(require.resolve('./resolve_import_conflicts'));
|
||||
loadTestFile(require.resolve('./resolve_import_errors'));
|
||||
loadTestFile(require.resolve('./update'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { AUTHENTICATION } from '../../common/lib/authentication';
|
||||
import { TestInvoker } from '../../common/lib/types';
|
||||
import { resolveImportConflictsTestSuiteFactory } from '../../common/suites/resolve_import_conflicts';
|
||||
import { resolveImportErrorsTestSuiteFactory } from '../../common/suites/resolve_import_errors';
|
||||
|
||||
// tslint:disable:no-default-export
|
||||
export default function({ getService }: TestInvoker) {
|
||||
|
@ -15,16 +15,16 @@ export default function({ getService }: TestInvoker) {
|
|||
const es = getService('es');
|
||||
|
||||
const {
|
||||
resolveImportConflictsTest,
|
||||
resolveImportErrorsTest,
|
||||
createExpectResults,
|
||||
expectRbacForbidden,
|
||||
expectUnknownType,
|
||||
expectRbacForbiddenWithUnknownType,
|
||||
expectRbacForbiddenForUnknownType,
|
||||
} = resolveImportConflictsTestSuiteFactory(es, esArchiver, supertest);
|
||||
} = resolveImportErrorsTestSuiteFactory(es, esArchiver, supertest);
|
||||
|
||||
describe('_resolve_import_conflicts', () => {
|
||||
resolveImportConflictsTest(`user with no access`, {
|
||||
describe('_resolve_import_errors', () => {
|
||||
resolveImportErrorsTest(`user with no access`, {
|
||||
user: AUTHENTICATION.NOT_A_KIBANA_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -38,7 +38,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`superuser`, {
|
||||
resolveImportErrorsTest(`superuser`, {
|
||||
user: AUTHENTICATION.SUPERUSER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -52,7 +52,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`legacy user`, {
|
||||
resolveImportErrorsTest(`legacy user`, {
|
||||
user: AUTHENTICATION.KIBANA_LEGACY_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -66,7 +66,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`dual-privileges user`, {
|
||||
resolveImportErrorsTest(`dual-privileges user`, {
|
||||
user: AUTHENTICATION.KIBANA_DUAL_PRIVILEGES_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -80,7 +80,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`dual-privileges readonly user`, {
|
||||
resolveImportErrorsTest(`dual-privileges readonly user`, {
|
||||
user: AUTHENTICATION.KIBANA_DUAL_PRIVILEGES_DASHBOARD_ONLY_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -94,7 +94,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`rbac user with all globally`, {
|
||||
resolveImportErrorsTest(`rbac user with all globally`, {
|
||||
user: AUTHENTICATION.KIBANA_RBAC_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -108,7 +108,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`rbac readonly user`, {
|
||||
resolveImportErrorsTest(`rbac readonly user`, {
|
||||
user: AUTHENTICATION.KIBANA_RBAC_DASHBOARD_ONLY_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -122,7 +122,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`rbac user with all at default space`, {
|
||||
resolveImportErrorsTest(`rbac user with all at default space`, {
|
||||
user: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_ALL_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -136,7 +136,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`rbac user with read at default space`, {
|
||||
resolveImportErrorsTest(`rbac user with read at default space`, {
|
||||
user: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_READ_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -150,7 +150,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`rbac user with all at space_1`, {
|
||||
resolveImportErrorsTest(`rbac user with all at space_1`, {
|
||||
user: AUTHENTICATION.KIBANA_RBAC_SPACE_1_ALL_USER,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -164,7 +164,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest(`rbac user with read at space_1`, {
|
||||
resolveImportErrorsTest(`rbac user with read at space_1`, {
|
||||
user: AUTHENTICATION.KIBANA_RBAC_SPACE_1_READ_USER,
|
||||
tests: {
|
||||
default: {
|
|
@ -19,7 +19,7 @@ export default function({ loadTestFile }: TestInvoker) {
|
|||
loadTestFile(require.resolve('./find'));
|
||||
loadTestFile(require.resolve('./get'));
|
||||
loadTestFile(require.resolve('./import'));
|
||||
loadTestFile(require.resolve('./resolve_import_conflicts'));
|
||||
loadTestFile(require.resolve('./resolve_import_errors'));
|
||||
loadTestFile(require.resolve('./update'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { SPACES } from '../../common/lib/spaces';
|
||||
import { TestInvoker } from '../../common/lib/types';
|
||||
import { resolveImportConflictsTestSuiteFactory } from '../../common/suites/resolve_import_conflicts';
|
||||
import { resolveImportErrorsTestSuiteFactory } from '../../common/suites/resolve_import_errors';
|
||||
|
||||
// tslint:disable:no-default-export
|
||||
export default function({ getService }: TestInvoker) {
|
||||
|
@ -15,13 +15,13 @@ export default function({ getService }: TestInvoker) {
|
|||
const es = getService('es');
|
||||
|
||||
const {
|
||||
resolveImportConflictsTest,
|
||||
resolveImportErrorsTest,
|
||||
createExpectResults,
|
||||
expectUnknownType,
|
||||
} = resolveImportConflictsTestSuiteFactory(es, esArchiver, supertest);
|
||||
} = resolveImportErrorsTestSuiteFactory(es, esArchiver, supertest);
|
||||
|
||||
describe('_resolve_import_conflicts', () => {
|
||||
resolveImportConflictsTest('in the current space (space_1)', {
|
||||
describe('_resolve_import_errors', () => {
|
||||
resolveImportErrorsTest('in the current space (space_1)', {
|
||||
...SPACES.SPACE_1,
|
||||
tests: {
|
||||
default: {
|
||||
|
@ -35,7 +35,7 @@ export default function({ getService }: TestInvoker) {
|
|||
},
|
||||
});
|
||||
|
||||
resolveImportConflictsTest('in the default space', {
|
||||
resolveImportErrorsTest('in the default space', {
|
||||
...SPACES.DEFAULT,
|
||||
tests: {
|
||||
default: {
|
Loading…
Reference in a new issue