@@ -17,6 +17,7 @@ import {
17
17
ClientMock ,
18
18
} from './configure_client.test.mocks' ;
19
19
import { loggingSystemMock } from '../../logging/logging_system.mock' ;
20
+ import { ClusterConnectionPool } from '@elastic/elasticsearch' ;
20
21
import type { ElasticsearchClientConfig } from './client_config' ;
21
22
import { configureClient } from './configure_client' ;
22
23
import { instrumentEsQueryAndDeprecationLogger } from './log_query_and_deprecation' ;
@@ -112,6 +113,21 @@ describe('configureClient', () => {
112
113
expect ( client ) . toBe ( ClientMock . mock . results [ 0 ] . value ) ;
113
114
} ) ;
114
115
116
+ it ( 'constructs a client using `ClusterConnectionPool` for `ConnectionPool` ' , ( ) => {
117
+ const mockedTransport = { mockTransport : true } ;
118
+ createTransportMock . mockReturnValue ( mockedTransport ) ;
119
+
120
+ const client = configureClient ( config , { logger, type : 'test' , scoped : false } ) ;
121
+
122
+ expect ( ClientMock ) . toHaveBeenCalledTimes ( 1 ) ;
123
+ expect ( ClientMock ) . toHaveBeenCalledWith (
124
+ expect . objectContaining ( {
125
+ ConnectionPool : ClusterConnectionPool ,
126
+ } )
127
+ ) ;
128
+ expect ( client ) . toBe ( ClientMock . mock . results [ 0 ] . value ) ;
129
+ } ) ;
130
+
115
131
it ( 'calls instrumentEsQueryAndDeprecationLogger' , ( ) => {
116
132
const client = configureClient ( config , { logger, type : 'test' , scoped : false } ) ;
117
133
0 commit comments