Skip to content

Commit

Permalink
enable http2 for the home function test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed May 28, 2024
1 parent da6d7d9 commit 69f81f2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion scripts/functional_test_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
* Side Public License, v 1.
*/

process.isFtrRunner = true;
require('../src/setup_node_env');
require('@kbn/test').runFtrCli();
1 change: 0 additions & 1 deletion scripts/functional_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
* Side Public License, v 1.
*/

process.isFtrRunner = true;
require('../src/setup_node_env');
require('@kbn/test').runTestsCli();
2 changes: 1 addition & 1 deletion src/setup_node_env/exit_on_warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function shouldIgnore(warn) {
col,
ftrOnly,
}) {
if (ftrOnly && !process.isFtrRunner) return false;
if (ftrOnly && !process.env.IS_FTR_RUNNER) return false;
if (name && name !== warn.name) return false;
if (code && code !== warn.code) return false;
if (message && message !== warn.message) return false;
Expand Down
7 changes: 6 additions & 1 deletion test/common/configure_http2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ type ConfigType = Record<string, any>;
/**
* Enables HTTP2 by adding/changing the appropriate config settings
*
* note: it DOES mutate the provided config.
* Important: this must be used on "final" (non-reused) configs, otherwise
* the override from the children configs could remote the overrides
* done in that helper.
*/
export const configureHTTP2 = (config: ConfigType): ConfigType => {
// Add env flag to avoid terminating on NODE_TLS_REJECT_UNAUTHORIZED warning
process.env.IS_FTR_RUNNER = 'true';

// tell native node agents to trust unsafe certificates
// this is ugly, but unfortunately required, as some libraries (such as supertest)
// have no real alternatives to accept self-signed certs
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/home/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
*/

import { FtrConfigProviderContext } from '@kbn/test';
import { configureHTTP2 } from '../../../common/configure_http2';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../../config.base.js'));

return {
return configureHTTP2({
...functionalConfig.getAll(),
testFiles: [require.resolve('.')],
};
});
}
5 changes: 2 additions & 3 deletions test/functional/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

import { pageObjects } from './page_objects';
import { services } from './services';
import { configureHTTP2 } from '../common/configure_http2';

export default async function ({ readConfigFile }) {
const commonConfig = await readConfigFile(require.resolve('../common/config'));

return configureHTTP2({
return {
pageObjects,
services,

Expand Down Expand Up @@ -482,5 +481,5 @@ export default async function ({ readConfigFile }) {
},
defaultRoles: ['test_logstash_reader', 'kibana_admin'],
},
});
};
}

0 comments on commit 69f81f2

Please sign in to comment.