diff --git a/src/core/server/saved_objects/routes/integration_tests/import.test.ts b/src/core/server/saved_objects/routes/integration_tests/import.test.ts index 821b1af5cbe7b..0bc03fbcf8038 100644 --- a/src/core/server/saved_objects/routes/integration_tests/import.test.ts +++ b/src/core/server/saved_objects/routes/integration_tests/import.test.ts @@ -28,6 +28,7 @@ import { SavedObjectsErrorHelpers } from '../..'; type SetupServerReturn = UnwrapPromise>; +const { v4: uuidv4 } = jest.requireActual('uuid'); const allowedTypes = ['index-pattern', 'visualization', 'dashboard']; const config = { maxImportPayloadBytes: 10485760, maxImportExportSize: 10000 } as SavedObjectConfig; const URL = '/internal/saved_objects/_import'; @@ -54,7 +55,7 @@ describe(`POST ${URL}`, () => { beforeEach(async () => { mockUuidv4.mockReset(); - mockUuidv4.mockImplementation(() => jest.requireActual('uuidv4')); + mockUuidv4.mockImplementation(() => uuidv4()); ({ server, httpSetup, handlerContext } = await setupServer()); handlerContext.savedObjects.typeRegistry.getImportableAndExportableTypes.mockReturnValue( allowedTypes.map(createExportableType) @@ -489,6 +490,7 @@ describe(`POST ${URL}`, () => { const result = await supertest(httpSetup.server.listener) .post(`${URL}?createNewCopies=true`) .set('content-Type', 'multipart/form-data; boundary=EXAMPLE') + .set('x-opaque-id', uuidv4()) // prevents src/core/server/http/http_tools.ts from using our mocked uuidv4 to generate a unique ID for this request .send( [ '--EXAMPLE', diff --git a/src/core/server/saved_objects/routes/integration_tests/resolve_import_errors.test.ts b/src/core/server/saved_objects/routes/integration_tests/resolve_import_errors.test.ts index 370f226c84e56..a933838cc92e3 100644 --- a/src/core/server/saved_objects/routes/integration_tests/resolve_import_errors.test.ts +++ b/src/core/server/saved_objects/routes/integration_tests/resolve_import_errors.test.ts @@ -27,6 +27,7 @@ import { SavedObjectConfig } from '../../saved_objects_config'; type SetupServerReturn = UnwrapPromise>; +const { v4: uuidv4 } = jest.requireActual('uuid'); const allowedTypes = ['index-pattern', 'visualization', 'dashboard']; const config = { maxImportPayloadBytes: 10485760, maxImportExportSize: 10000 } as SavedObjectConfig; const URL = '/api/saved_objects/_resolve_import_errors'; @@ -58,7 +59,7 @@ describe(`POST ${URL}`, () => { beforeEach(async () => { mockUuidv4.mockReset(); - mockUuidv4.mockImplementation(() => jest.requireActual('uuidv4')); + mockUuidv4.mockImplementation(() => uuidv4()); ({ server, httpSetup, handlerContext } = await setupServer()); handlerContext.savedObjects.typeRegistry.getImportableAndExportableTypes.mockReturnValue( allowedTypes.map(createExportableType)