forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support 1 Kibana and 1 Elasticsearch URL as input params (elastic#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
- Loading branch information
Lee Drengenberg
committed
Apr 19, 2018
1 parent
6a7c047
commit 25f5415
Showing
4 changed files
with
64 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,17 @@ There are three ways to run the tests depending on your goals: | |
+ | ||
["source","shell"] | ||
---------- | ||
export TEST_KIBANA_URL=https://kibana:[email protected]:443 | ||
export TEST_ES_URL=https://elastic:[email protected]: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’); | ||
----------- | ||
----------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:[email protected]: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(); |