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