diff --git a/src/core/server/saved_objects/import/import_saved_objects.ts b/src/core/server/saved_objects/import/import_saved_objects.ts index 0ad51fe47cfb..46db9dc3a9ce 100644 --- a/src/core/server/saved_objects/import/import_saved_objects.ts +++ b/src/core/server/saved_objects/import/import_saved_objects.ts @@ -86,17 +86,6 @@ export async function importSavedObjectsFromStream({ // randomly generated id importIdMap = regenerateIds(collectSavedObjectsResult.collectedObjects, dataSourceId); } else { - // in check conclict and override mode - - if (workspaces) { - importIdMap = await regenerateIdsWithReference({ - savedObjects: collectSavedObjectsResult.collectedObjects, - savedObjectsClient, - workspaces, - objectLimit, - importIdMap, - }); - } // Check single-namespace objects for conflicts in this namespace, and check multi-namespace objects for conflicts across all namespaces const checkConflictsParams = { objects: collectSavedObjectsResult.collectedObjects, diff --git a/src/core/server/saved_objects/import/regenerate_ids.test.ts b/src/core/server/saved_objects/import/regenerate_ids.test.ts index 895b90a89324..c7dbfb8b50bc 100644 --- a/src/core/server/saved_objects/import/regenerate_ids.test.ts +++ b/src/core/server/saved_objects/import/regenerate_ids.test.ts @@ -29,10 +29,8 @@ */ import { mockUuidv4 } from './__mocks__'; -import { regenerateIds, regenerateIdsWithReference } from './regenerate_ids'; +import { regenerateIds } from './regenerate_ids'; import { SavedObject } from '../types'; -import { savedObjectsClientMock } from '../service/saved_objects_client.mock'; -import { SavedObjectsBulkResponse } from '../service'; describe('#regenerateIds', () => { const objects = ([ @@ -70,70 +68,3 @@ describe('#regenerateIds', () => { `); }); }); - -describe('#regenerateIdsWithReference', () => { - const objects = ([ - { type: 'foo', id: '1' }, - { type: 'bar', id: '2' }, - { type: 'baz', id: '3' }, - ] as any) as SavedObject[]; - - test('returns expected values', async () => { - const mockedSavedObjectsClient = savedObjectsClientMock.create(); - mockUuidv4.mockReturnValueOnce('uuidv4 #1'); - const result: SavedObjectsBulkResponse = { - saved_objects: [ - { - error: { - statusCode: 404, - error: '', - message: '', - }, - id: '1', - type: 'foo', - attributes: {}, - references: [], - }, - { - id: '2', - type: 'bar', - attributes: {}, - references: [], - workspaces: ['bar'], - }, - { - id: '3', - type: 'baz', - attributes: {}, - references: [], - workspaces: ['foo'], - }, - ], - }; - mockedSavedObjectsClient.bulkGet.mockResolvedValue(result); - expect( - await regenerateIdsWithReference({ - savedObjects: objects, - savedObjectsClient: mockedSavedObjectsClient, - workspaces: ['bar'], - objectLimit: 1000, - importIdMap: new Map(), - }) - ).toMatchInlineSnapshot(` - Map { - "foo:1" => Object { - "id": "1", - "omitOriginId": true, - }, - "bar:2" => Object { - "id": "2", - "omitOriginId": false, - }, - "baz:3" => Object { - "id": "uuidv4 #1", - "omitOriginId": true, - }, - } - `); - }); -});