Skip to content

Commit

Permalink
fixing API integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Sep 1, 2021
1 parent f8ac6e1 commit 6d876b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/core/server/saved_objects/import/import_saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,12 @@ export async function importSavedObjectsFromStream({
});
const errorResults = errorAccumulator.map((error) => {
const icon = typeRegistry.getType(error.type)?.management?.icon;
const namespaceType = typeRegistry.getType(error.type)?.namespaceType;
const attemptedOverwrite = pendingOverwrites.has(getObjKey(error));
return {
...error,
namespaces: importNamespaces ? error.namespaces : undefined,
meta: { ...error.meta, icon },
meta: { ...error.meta, icon, namespaceType },
...(attemptedOverwrite && { overwrite: true }),
};
});
Expand Down
14 changes: 10 additions & 4 deletions test/api_integration/apis/saved_objects/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ export default function ({ getService }: FtrProviderContext) {
const indexPattern = {
type: 'index-pattern',
id: '91200a00-9efd-11e7-acb3-3dab96693fab',
meta: { title: 'logstash-*', icon: 'indexPatternApp' },
meta: { title: 'logstash-*', icon: 'indexPatternApp', namespaceType: 'single' as const },
};
const visualization = {
type: 'visualization',
id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab',
meta: { title: 'Count of requests', icon: 'visualizeApp' },
meta: { title: 'Count of requests', icon: 'visualizeApp', namespaceType: 'single' as const },
};
const dashboard = {
type: 'dashboard',
id: 'be3733a0-9efe-11e7-acb3-3dab96693fab',
meta: { title: 'Requests', icon: 'dashboardApp' },
meta: { title: 'Requests', icon: 'dashboardApp', namespaceType: 'single' as const },
};

describe('with basic data existing', () => {
Expand Down Expand Up @@ -155,6 +155,7 @@ export default function ({ getService }: FtrProviderContext) {
meta: {
icon: 'dashboardApp',
title: 'dashboard-b',
namespaceType: 'single',
},
type: 'dashboard',
},
Expand All @@ -163,6 +164,7 @@ export default function ({ getService }: FtrProviderContext) {
meta: {
icon: 'dashboardApp',
title: 'dashboard-a',
namespaceType: 'single',
},
type: 'dashboard',
},
Expand Down Expand Up @@ -222,7 +224,11 @@ export default function ({ getService }: FtrProviderContext) {
type: 'visualization',
id: '1',
title: 'My visualization',
meta: { title: 'My visualization', icon: 'visualizeApp' },
meta: {
title: 'My visualization',
icon: 'visualizeApp',
namespaceType: 'single',
},
error: {
type: 'missing_references',
references: [
Expand Down
10 changes: 5 additions & 5 deletions test/api_integration/apis/saved_objects/resolve_import_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const kibanaServer = getService('kibanaServer');

describe('resolve_import_errors', () => {
describe('TOTO resolve_import_errors', () => {
// mock success results including metadata
const indexPattern = {
type: 'index-pattern',
id: '91200a00-9efd-11e7-acb3-3dab96693fab',
meta: { title: 'logstash-*', icon: 'indexPatternApp' },
meta: { title: 'logstash-*', icon: 'indexPatternApp', namespaceType: 'single' },
};
const visualization = {
type: 'visualization',
id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab',
meta: { title: 'Count of requests', icon: 'visualizeApp' },
meta: { title: 'Count of requests', icon: 'visualizeApp', namespaceType: 'single' },
};
const dashboard = {
type: 'dashboard',
id: 'be3733a0-9efe-11e7-acb3-3dab96693fab',
meta: { title: 'Requests', icon: 'dashboardApp' },
meta: { title: 'Requests', icon: 'dashboardApp', namespaceType: 'single' },
};
const SPACE_ID = 'ftr-so-resolve_import_errors';

Expand Down Expand Up @@ -162,7 +162,7 @@ export default function ({ getService }: FtrProviderContext) {
{
type: 'visualization',
id: '1',
meta: { title: 'My favorite vis', icon: 'visualizeApp' },
meta: { title: 'My favorite vis', icon: 'visualizeApp', namespaceType: 'single' },
},
],
warnings: [],
Expand Down

0 comments on commit 6d876b3

Please sign in to comment.