mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
The test has been modified to no longer rely upon @kbn/test as it was providing very little benefit, and introduced some variability in ensuring we were displaying the proper URL.
This commit is contained in:
parent
df431c1287
commit
ed354d6682
2 changed files with 9 additions and 7 deletions
|
@ -26,11 +26,10 @@ const NoConnections = require('elasticsearch').errors.NoConnections;
|
|||
import mappings from './fixtures/mappings';
|
||||
import healthCheck from '../health_check';
|
||||
import kibanaVersion from '../kibana_version';
|
||||
import { esTestConfig } from '@kbn/test';
|
||||
import * as patchKibanaIndexNS from '../patch_kibana_index';
|
||||
|
||||
const esPort = esTestConfig.getPort();
|
||||
const esUrl = esTestConfig.getUrl();
|
||||
const esPort = 9220;
|
||||
const esUrl = `http://elastic:changement@localhost:9220`;
|
||||
|
||||
describe('plugins/elasticsearch', () => {
|
||||
describe('lib/health_check', function () {
|
||||
|
@ -162,7 +161,7 @@ describe('plugins/elasticsearch', () => {
|
|||
sinon.assert.calledOnce(plugin.status.red);
|
||||
sinon.assert.calledWithExactly(
|
||||
plugin.status.red,
|
||||
`Unable to connect to Elasticsearch at ${esUrl}.`
|
||||
`Unable to connect to Elasticsearch at http://localhost:9220/.`
|
||||
);
|
||||
|
||||
sinon.assert.calledTwice(ping);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import url from 'url';
|
||||
import Promise from 'bluebird';
|
||||
import elasticsearch from 'elasticsearch';
|
||||
import kibanaVersion from './kibana_version';
|
||||
|
@ -33,12 +34,14 @@ export default function (plugin, server) {
|
|||
const REQUEST_DELAY = config.get('elasticsearch.healthCheck.delay');
|
||||
|
||||
plugin.status.yellow('Waiting for Elasticsearch');
|
||||
function waitForPong(callWithInternalUser, url) {
|
||||
function waitForPong(callWithInternalUser, elasticsearchUrl) {
|
||||
return callWithInternalUser('ping').catch(function (err) {
|
||||
if (!(err instanceof NoConnections)) throw err;
|
||||
plugin.status.red(`Unable to connect to Elasticsearch at ${url}.`);
|
||||
|
||||
return Promise.delay(REQUEST_DELAY).then(waitForPong.bind(null, callWithInternalUser, url));
|
||||
const displayUrl = url.format({ ...url.parse(elasticsearchUrl), auth: undefined });
|
||||
plugin.status.red(`Unable to connect to Elasticsearch at ${displayUrl}.`);
|
||||
|
||||
return Promise.delay(REQUEST_DELAY).then(waitForPong.bind(null, callWithInternalUser, elasticsearchUrl));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue