kibana/test/api_integration/apis/custom_integration/integrations.ts
Navarone Feekery ef7677341b
[Search] Fix integration id overlap for connectors (#184353)
## Summary

Connectors registered as custom integrations use the value in
`connector.serviceType` as an id. However, there are some connectors
that share a service type. This causes an error when running Kibana due
to the id clash.

This PR changes the id into a concatenation of `serviceType` and `name`
to ensure all ids are unique.

Errors before change (these no longer recur after the changes):

```log
[2024-05-28T12:06:10.514+00:00][ERROR][plugins.customIntegrations] Integration with id=confluence already exists.
[2024-05-28T12:06:10.516+00:00][ERROR][plugins.customIntegrations] Integration with id=jira already exists.
[2024-05-28T12:06:10.517+00:00][ERROR][plugins.customIntegrations] Integration with id=jira already exists.
[2024-05-28T12:06:10.518+00:00][ERROR][plugins.customIntegrations] Integration with id=salesforce already exists
```
2024-05-28 18:50:23 +02:00

47 lines
1.6 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
describe('customIntegrations', () => {
describe('get list of append integrations', () => {
it('should return list of custom integrations that can be appended', async () => {
const resp = await supertest
.get(`/internal/customIntegrations/appendCustomIntegrations`)
.set('kbn-xsrf', 'kibana')
.expect(200);
expect(resp.body).to.be.an('array');
expect(resp.body.length).to.be(55);
// Test for sample data card
expect(resp.body.findIndex((c: { id: string }) => c.id === 'sample_data_all')).to.be.above(
-1
);
});
});
describe('get list of replacement integrations', () => {
it('should return list of custom integrations that can be used to replace EPR packages', async () => {
const resp = await supertest
.get(`/internal/customIntegrations/replacementCustomIntegrations`)
.set('kbn-xsrf', 'kibana')
.expect(200);
expect(resp.body).to.be.an('array');
expect(resp.body.length).to.be(109); // the beats
});
});
});
}