mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[ftr/services/kbnServer] set uiSetting defaults more often (#30459)
* [ftr/services/kbnServer] set uiSetting defaults more often * [ftr/services/uiSettings] only init defaults when they're defined
This commit is contained in:
parent
3fba1f3fd5
commit
476c4cd099
3 changed files with 11 additions and 4 deletions
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const ES_ARCHIVER_LOAD_METHODS = ['load', 'loadIfNeeded'];
|
||||
const ES_ARCHIVER_LOAD_METHODS = ['load', 'loadIfNeeded', 'unload'];
|
||||
const KIBANA_INDEX = '.kibana';
|
||||
|
||||
export function extendEsArchiver({ esArchiver, kibanaServer, defaults }) {
|
||||
|
@ -35,7 +35,7 @@ export function extendEsArchiver({ esArchiver, kibanaServer, defaults }) {
|
|||
|
||||
// if the kibana index was created by the esArchiver then update the uiSettings
|
||||
// with the defaults to make sure that they are always in place initially
|
||||
if (stats[KIBANA_INDEX] && stats[KIBANA_INDEX].created) {
|
||||
if (stats[KIBANA_INDEX] && (stats[KIBANA_INDEX].created || stats[KIBANA_INDEX].deleted)) {
|
||||
await kibanaServer.uiSettings.update(defaults);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,14 @@ import { KibanaServerVersion } from './version';
|
|||
export function KibanaServerProvider({ getService }) {
|
||||
const log = getService('log');
|
||||
const config = getService('config');
|
||||
const lifecycle = getService('lifecycle');
|
||||
|
||||
return new class KibanaServer {
|
||||
constructor() {
|
||||
const url = formatUrl(config.get('servers.kibana'));
|
||||
this.status = new KibanaServerStatus(url);
|
||||
this.version = new KibanaServerVersion(this.status);
|
||||
this.uiSettings = new KibanaServerUiSettings(url, log, config.get('uiSettings.defaults'));
|
||||
this.uiSettings = new KibanaServerUiSettings(url, log, config.get('uiSettings.defaults'), lifecycle);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ const MINUTE = 60 * 1000;
|
|||
const HOUR = 60 * MINUTE;
|
||||
|
||||
export class KibanaServerUiSettings {
|
||||
constructor(url, log, defaults) {
|
||||
constructor(url, log, defaults, lifecycle) {
|
||||
this._log = log;
|
||||
this._defaults = defaults;
|
||||
this._wreck = Wreck.defaults({
|
||||
|
@ -33,6 +33,12 @@ export class KibanaServerUiSettings {
|
|||
json: true,
|
||||
redirects: 3,
|
||||
});
|
||||
|
||||
if (this._defaults) {
|
||||
lifecycle.on('beforeTests', async () => {
|
||||
await this.update(defaults);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue