mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Functional tests - Add esSupertest support for SSL (#90425)
This PR allows the functional test service esSupertest to work correctly in environments that have ES SSL enabled in the Kibana server configuration.
This commit is contained in:
parent
af75079a31
commit
523110d4bd
2 changed files with 12 additions and 2 deletions
|
@ -19,6 +19,14 @@ export function KibanaSupertestProvider({ getService }: FtrProviderContext) {
|
|||
|
||||
export function ElasticsearchSupertestProvider({ getService }: FtrProviderContext) {
|
||||
const config = getService('config');
|
||||
const elasticSearchServerUrl = formatUrl(config.get('servers.elasticsearch'));
|
||||
return supertestAsPromised(elasticSearchServerUrl);
|
||||
const esServerConfig = config.get('servers.elasticsearch');
|
||||
const elasticSearchServerUrl = formatUrl(esServerConfig);
|
||||
|
||||
let agentOptions = {};
|
||||
if ('certificateAuthorities' in esServerConfig) {
|
||||
agentOptions = { ca: esServerConfig!.certificateAuthorities };
|
||||
}
|
||||
|
||||
// @ts-ignore - supertestAsPromised doesn't like the agentOptions, but still passes it correctly to supertest
|
||||
return supertestAsPromised.agent(elasticSearchServerUrl, agentOptions);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import Fs from 'fs';
|
||||
import { resolve, join } from 'path';
|
||||
import { CA_CERT_PATH } from '@kbn/dev-utils';
|
||||
import { FtrConfigProviderContext } from '@kbn/test/types/ftr';
|
||||
|
@ -33,6 +34,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
elasticsearch: {
|
||||
...xpackFunctionalConfig.get('servers.elasticsearch'),
|
||||
protocol: 'https',
|
||||
certificateAuthorities: [Fs.readFileSync(CA_CERT_PATH)],
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue