mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Support 1 Kibana and 1 Elasticsearch URL as input params (#9760)
* Support 1 Kibana and 1 Elasticsearch URL as input params * Revert a previous change to test char substitution * Allow setting TEST_KIBANA_URL and TEST_ES_URL for Cloud testing * cleanup comment * Update docs * Refactor after PR review * Changes from review * fix default Kibana port to 5620 * Change es_test_config.js similar to kibana_test_server_url_parts.js
This commit is contained in:
parent
bf2b6b01d4
commit
842ed488c5
4 changed files with 64 additions and 14 deletions
|
@ -36,6 +36,17 @@ There are three ways to run the tests depending on your goals:
|
|||
+
|
||||
["source","shell"]
|
||||
----------
|
||||
export TEST_KIBANA_URL=https://kibana:password@my-kibana-instance.internal.net:443
|
||||
|
||||
export TEST_ES_URL=https://elastic:password@my-es-cluster.internal.net:9200
|
||||
node scripts/functional_test_runner
|
||||
----------
|
||||
|
||||
|
||||
** Or you can override any or all of these individual parts of the URL and leave the others to the default values.
|
||||
+
|
||||
["source","shell"]
|
||||
----------
|
||||
export TEST_KIBANA_PROTOCOL=https
|
||||
export TEST_KIBANA_HOSTNAME=my-kibana-instance.internal.net
|
||||
export TEST_KIBANA_PORT=443
|
||||
|
@ -405,4 +416,4 @@ const log = getService(‘log’);
|
|||
|
||||
// log.debug only writes when using the `--debug` or `--verbose` flag.
|
||||
log.debug(‘done clicking menu’);
|
||||
-----------
|
||||
-----------
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { format as formatUrl } from 'url';
|
||||
import url, { format as formatUrl } from 'url';
|
||||
import pkg from '../../../package.json';
|
||||
import { admin } from '../../../test/shield';
|
||||
|
||||
|
@ -20,13 +20,32 @@ export const esTestConfig = new class EsTestConfig {
|
|||
}
|
||||
|
||||
getUrlParts() {
|
||||
// Allow setting one complete TEST_ES_URL for Es like https://elastic:changeme@myCloudInstance:9200
|
||||
if (process.env.TEST_ES_URL) {
|
||||
const testEsUrl = url.parse(process.env.TEST_ES_URL);
|
||||
return {
|
||||
// have to remove the ":" off protocol
|
||||
protocol: testEsUrl.protocol.slice(0, -1),
|
||||
hostname: testEsUrl.hostname,
|
||||
port: parseInt(testEsUrl.port, 10),
|
||||
username: testEsUrl.auth.split(':')[0],
|
||||
password: testEsUrl.auth.split(':')[1],
|
||||
auth: testEsUrl.auth
|
||||
};
|
||||
}
|
||||
|
||||
const username = process.env.TEST_KIBANA_USERNAME || admin.username;
|
||||
const password = process.env.TEST_KIBANA_PASSWORD || admin.password;
|
||||
return {
|
||||
// Allow setting any individual component(s) of the URL,
|
||||
// or use default values (username and password from shield.js)
|
||||
protocol: process.env.TEST_ES_PROTOCOL || 'http',
|
||||
hostname: process.env.TEST_ES_HOSTNAME || 'localhost',
|
||||
port: parseInt(process.env.TEST_ES_PORT, 10) || 9220,
|
||||
auth: admin.username + ':' + admin.password,
|
||||
username: admin.username,
|
||||
password: admin.password,
|
||||
auth: `${username}:${password}`,
|
||||
username: username,
|
||||
password: password,
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
return PageObjects.common.navigateToApp('console');
|
||||
});
|
||||
|
||||
it('should show the default *%^$# @ ! ~ request', function () {
|
||||
it('should show the default request', function () {
|
||||
// collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled
|
||||
return PageObjects.console.collapseHelp()
|
||||
.then(function () {
|
||||
|
|
|
@ -1,10 +1,30 @@
|
|||
import { kibanaUser } from './shield';
|
||||
import url from 'url';
|
||||
|
||||
export const kibanaTestServerUrlParts = {
|
||||
protocol: process.env.TEST_KIBANA_PROTOCOL || 'http',
|
||||
hostname: process.env.TEST_KIBANA_HOSTNAME || 'localhost',
|
||||
port: parseInt(process.env.TEST_KIBANA_PORT, 10) || 5620,
|
||||
auth: kibanaUser.username + ':' + kibanaUser.password,
|
||||
username: kibanaUser.username,
|
||||
password: kibanaUser.password,
|
||||
};
|
||||
function getUrlParts() {
|
||||
// allow setting one complete TEST_KIBANA_URL for ES like https://elastic:changeme@example.com:9200
|
||||
if (process.env.TEST_KIBANA_URL) {
|
||||
const testKibanaUrl = url.parse(process.env.TEST_KIBANA_URL);
|
||||
return {
|
||||
protocol: testKibanaUrl.protocol.slice(0, -1),
|
||||
hostname: testKibanaUrl.hostname,
|
||||
port: parseInt(testKibanaUrl.port, 10),
|
||||
auth: testKibanaUrl.auth,
|
||||
username: testKibanaUrl.auth.split(':')[0],
|
||||
password: testKibanaUrl.auth.split(':')[1]
|
||||
};
|
||||
}
|
||||
|
||||
const username = process.env.TEST_KIBANA_USERNAME || kibanaUser.username;
|
||||
const password = process.env.TEST_KIBANA_PASSWORD || kibanaUser.password;
|
||||
return {
|
||||
protocol: process.env.TEST_KIBANA_PROTOCOL || 'http',
|
||||
hostname: process.env.TEST_KIBANA_HOSTNAME || 'localhost',
|
||||
port: parseInt(process.env.TEST_KIBANA_PORT, 10) || 5620,
|
||||
auth: `${username}:${password}`,
|
||||
username,
|
||||
password,
|
||||
};
|
||||
}
|
||||
|
||||
export const kibanaTestServerUrlParts = getUrlParts();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue