mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ftr/config] require servers.elasticsearch.port config (#126650)
This commit is contained in:
parent
f72419889f
commit
0bb021199e
9 changed files with 55 additions and 46 deletions
|
@ -37,5 +37,10 @@ export default function () {
|
|||
captureLogOutput: false,
|
||||
sendToCiStats: false,
|
||||
},
|
||||
servers: {
|
||||
elasticsearch: {
|
||||
port: 1234,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,4 +13,9 @@ export default () => ({
|
|||
mochaReporter: {
|
||||
sendToCiStats: false,
|
||||
},
|
||||
servers: {
|
||||
elasticsearch: {
|
||||
port: 1234,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -61,7 +61,7 @@ describe('failure hooks', function () {
|
|||
|
||||
expect(tests).toHaveLength(0);
|
||||
} catch (error) {
|
||||
console.error('full log output', linesCopy.join('\n'));
|
||||
error.message += `\n\nfull log output:${linesCopy.join('\n')}`;
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,5 +9,10 @@
|
|||
export default function () {
|
||||
return {
|
||||
testFiles: ['config.1'],
|
||||
servers: {
|
||||
elasticsearch: {
|
||||
port: 1234,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,5 +11,10 @@ export default async function ({ readConfigFile }) {
|
|||
|
||||
return {
|
||||
testFiles: [...config1.get('testFiles'), 'config.2'],
|
||||
servers: {
|
||||
elasticsearch: {
|
||||
port: 1234,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export default async function ({ readConfigFile }) {
|
||||
const config4 = await readConfigFile(require.resolve('./config.4'));
|
||||
return {
|
||||
testFiles: ['baz'],
|
||||
screenshots: {
|
||||
...config4.get('screenshots'),
|
||||
},
|
||||
};
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export default function () {
|
||||
return {
|
||||
screenshots: {
|
||||
directory: 'bar',
|
||||
},
|
||||
};
|
||||
}
|
|
@ -15,6 +15,11 @@ describe('Config', () => {
|
|||
services: {
|
||||
foo: () => 42,
|
||||
},
|
||||
servers: {
|
||||
elasticsearch: {
|
||||
port: 1234,
|
||||
},
|
||||
},
|
||||
},
|
||||
primary: true,
|
||||
path: process.cwd(),
|
||||
|
|
|
@ -17,19 +17,33 @@ const ID_PATTERN = /^[a-zA-Z0-9_]+$/;
|
|||
// it will search both --inspect and --inspect-brk
|
||||
const INSPECTING = !!process.execArgv.find((arg) => arg.includes('--inspect'));
|
||||
|
||||
const urlPartsSchema = () =>
|
||||
const maybeRequireKeys = (keys: string[], schemas: Record<string, Joi.Schema>) => {
|
||||
if (!keys.length) {
|
||||
return schemas;
|
||||
}
|
||||
|
||||
const withRequires: Record<string, Joi.Schema> = {};
|
||||
for (const [key, schema] of Object.entries(schemas)) {
|
||||
withRequires[key] = keys.includes(key) ? schema.required() : schema;
|
||||
}
|
||||
return withRequires;
|
||||
};
|
||||
|
||||
const urlPartsSchema = ({ requiredKeys }: { requiredKeys?: string[] } = {}) =>
|
||||
Joi.object()
|
||||
.keys({
|
||||
protocol: Joi.string().valid('http', 'https').default('http'),
|
||||
hostname: Joi.string().hostname().default('localhost'),
|
||||
port: Joi.number(),
|
||||
auth: Joi.string().regex(/^[^:]+:.+$/, 'username and password separated by a colon'),
|
||||
username: Joi.string(),
|
||||
password: Joi.string(),
|
||||
pathname: Joi.string().regex(/^\//, 'start with a /'),
|
||||
hash: Joi.string().regex(/^\//, 'start with a /'),
|
||||
certificateAuthorities: Joi.array().items(Joi.binary()).optional(),
|
||||
})
|
||||
.keys(
|
||||
maybeRequireKeys(requiredKeys ?? [], {
|
||||
protocol: Joi.string().valid('http', 'https').default('http'),
|
||||
hostname: Joi.string().hostname().default('localhost'),
|
||||
port: Joi.number(),
|
||||
auth: Joi.string().regex(/^[^:]+:.+$/, 'username and password separated by a colon'),
|
||||
username: Joi.string(),
|
||||
password: Joi.string(),
|
||||
pathname: Joi.string().regex(/^\//, 'start with a /'),
|
||||
hash: Joi.string().regex(/^\//, 'start with a /'),
|
||||
certificateAuthorities: Joi.array().items(Joi.binary()).optional(),
|
||||
})
|
||||
)
|
||||
.default();
|
||||
|
||||
const appUrlPartsSchema = () =>
|
||||
|
@ -170,7 +184,9 @@ export const schema = Joi.object()
|
|||
servers: Joi.object()
|
||||
.keys({
|
||||
kibana: urlPartsSchema(),
|
||||
elasticsearch: urlPartsSchema(),
|
||||
elasticsearch: urlPartsSchema({
|
||||
requiredKeys: ['port'],
|
||||
}),
|
||||
})
|
||||
.default(),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue