Skip to content

Commit

Permalink
esArchiver: retry kibana config update (#43987)
Browse files Browse the repository at this point in the history
* [services/es_archiver] retry uiSettings update

* run x-pack-ciGroup7 30x times

* Revert "run x-pack-ciGroup7 30x times"

This reverts commit 80e199c.

* [saved_object_api_integration/common/services] add retry service to the set

* add retry service for x-pack api tests
  • Loading branch information
dmlemeshko authored Aug 27, 2019
1 parent 697033f commit 48c6109
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/common/services/es_archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function EsArchiverProvider({ getService, hasService }: FtrProviderContex
KibanaServer.extendEsArchiver({
esArchiver,
kibanaServer: getService('kibanaServer'),
retry: getService('retry'),
defaults: config.get('uiSettings.defaults'),
});
}
Expand Down
6 changes: 4 additions & 2 deletions test/common/services/kibana_server/extend_es_archiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
const ES_ARCHIVER_LOAD_METHODS = ['load', 'loadIfNeeded', 'unload'];
const KIBANA_INDEX = '.kibana';

export function extendEsArchiver({ esArchiver, kibanaServer, defaults }) {
export function extendEsArchiver({ esArchiver, kibanaServer, retry, defaults }) {
// only extend the esArchiver if there are default uiSettings to restore
if (!defaults) {
return;
Expand All @@ -36,7 +36,9 @@ 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 || stats[KIBANA_INDEX].deleted)) {
await kibanaServer.uiSettings.update(defaults);
await retry.try(async () => {
await kibanaServer.uiSettings.update(defaults);
});
}

return stats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const services = {
esSupertestWithoutAuth: apiIntegrationServices.esSupertestWithoutAuth,
supertest: kibanaApiIntegrationServices.supertest,
supertestWithoutAuth: apiIntegrationServices.supertestWithoutAuth,
retry: kibanaApiIntegrationServices.retry,
esArchiver: kibanaFunctionalServices.esArchiver,
kibanaServer: kibanaFunctionalServices.kibanaServer,
};
1 change: 1 addition & 0 deletions x-pack/test/spaces_api_integration/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
esSupertestWithoutAuth: config.xpack.api.get('services.esSupertestWithoutAuth'),
supertest: config.kibana.api.get('services.supertest'),
supertestWithoutAuth: config.xpack.api.get('services.supertestWithoutAuth'),
retry: config.xpack.api.get('services.retry'),
esArchiver: config.kibana.functional.get('services.esArchiver'),
kibanaServer: config.kibana.functional.get('services.kibanaServer'),
},
Expand Down

0 comments on commit 48c6109

Please sign in to comment.