mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
(cherry picked from commit 6decdc3b82
)
# Conflicts:
# src/core/server/elasticsearch/client/configure_client.ts
This commit is contained in:
parent
962d241e70
commit
21b3712c39
2 changed files with 19 additions and 1 deletions
|
@ -17,6 +17,7 @@ import {
|
|||
ClientMock,
|
||||
} from './configure_client.test.mocks';
|
||||
import { loggingSystemMock } from '../../logging/logging_system.mock';
|
||||
import { ClusterConnectionPool } from '@elastic/elasticsearch';
|
||||
import type { ElasticsearchClientConfig } from './client_config';
|
||||
import { configureClient } from './configure_client';
|
||||
import { instrumentEsQueryAndDeprecationLogger } from './log_query_and_deprecation';
|
||||
|
@ -112,6 +113,21 @@ describe('configureClient', () => {
|
|||
expect(client).toBe(ClientMock.mock.results[0].value);
|
||||
});
|
||||
|
||||
it('constructs a client using `ClusterConnectionPool` for `ConnectionPool` ', () => {
|
||||
const mockedTransport = { mockTransport: true };
|
||||
createTransportMock.mockReturnValue(mockedTransport);
|
||||
|
||||
const client = configureClient(config, { logger, type: 'test', scoped: false });
|
||||
|
||||
expect(ClientMock).toHaveBeenCalledTimes(1);
|
||||
expect(ClientMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
ConnectionPool: ClusterConnectionPool,
|
||||
})
|
||||
);
|
||||
expect(client).toBe(ClientMock.mock.results[0].value);
|
||||
});
|
||||
|
||||
it('calls instrumentEsQueryAndDeprecationLogger', () => {
|
||||
const client = configureClient(config, { logger, type: 'test', scoped: false });
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { Client, HttpConnection } from '@elastic/elasticsearch';
|
||||
import { Client, HttpConnection, ClusterConnectionPool } from '@elastic/elasticsearch';
|
||||
import { Logger } from '../../logging';
|
||||
import { parseClientOptions, ElasticsearchClientConfig } from './client_config';
|
||||
import { instrumentEsQueryAndDeprecationLogger } from './log_query_and_deprecation';
|
||||
|
@ -35,6 +35,8 @@ export const configureClient = (
|
|||
...clientOptions,
|
||||
Transport: KibanaTransport,
|
||||
Connection: HttpConnection,
|
||||
// using ClusterConnectionPool until https://github.com/elastic/elasticsearch-js/issues/1714 is addressed
|
||||
ConnectionPool: ClusterConnectionPool,
|
||||
});
|
||||
|
||||
instrumentEsQueryAndDeprecationLogger({ logger, client, type });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue