[tests/functional] catch and ignore errors during stabilization (#11906)

This commit is contained in:
Spencer 2017-05-25 14:06:54 -07:00 committed by GitHub
parent c57a775060
commit eb31af6d7b

View file

@ -32,13 +32,24 @@ export function KibanaServerProvider({ getService }) {
const startMs = Date.now(); const startMs = Date.now();
const timeout = config.get('timeouts.kibanaStabilize'); const timeout = config.get('timeouts.kibanaStabilize');
while (true) { let exists;
const exists = await uiSettings.existInEs(); let state;
const state = await status.getOverallState();
if (exists && state === 'green') { while (true) {
log.debug(`Kibana uiSettings are in elasticsearch and the server is reporting a green status`); try {
return; exists = await uiSettings.existInEs();
state = await status.getOverallState();
if (exists && state === 'green') {
log.debug(`Kibana uiSettings are in elasticsearch and the server is reporting a green status`);
return;
}
} catch (err) {
log.warning(`Failed to check for kibana stabilization: ${err.stack}`);
}
if (Date.now() - startMs >= timeout) {
break;
} }
if (firstCheck) { if (firstCheck) {
@ -46,15 +57,11 @@ export function KibanaServerProvider({ getService }) {
firstCheck = false; firstCheck = false;
log.debug(`waiting up to ${timeout}ms for kibana to stabilize...`); log.debug(`waiting up to ${timeout}ms for kibana to stabilize...`);
} }
await delay(pingInterval);
if (Date.now() - startMs < timeout) {
await delay(pingInterval);
continue;
}
const docState = exists ? 'exists' : `doesn't exist`;
throw new Error(`Kibana never stabilized: config doc ${docState} and status is ${state}`);
} }
const docState = exists ? 'exists' : `doesn't exist`;
throw new Error(`Kibana never stabilized: config doc ${docState} and status is ${state}`);
} }
} }