Skip to content

Commit

Permalink
Fixes the client to setup SSL with the CA certificates for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed May 6, 2020
1 parent 23bb1aa commit 1cff871
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/common/services/elasticsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@
*/

import { format as formatUrl } from 'url';

import fs from 'fs';
import { Client } from '@elastic/elasticsearch';
import { CA_CERT_PATH } from '@kbn/dev-utils';

import { FtrProviderContext } from '../ftr_provider_context';

export function ElasticsearchProvider({ getService }: FtrProviderContext) {
const config = getService('config');

return new Client({
ssl: {
ca: fs.readFileSync(CA_CERT_PATH, 'utf-8'),
},
nodes: [formatUrl(config.get('servers.elasticsearch'))],
requestTimeout: config.get('timeouts.esRequestTimeout'),
});
Expand Down

0 comments on commit 1cff871

Please sign in to comment.