From 145945ebbf3bed007a806f26b22cd89f2608f22a Mon Sep 17 00:00:00 2001 From: Dmitry Lemeshko Date: Wed, 28 Aug 2019 03:00:39 +0200 Subject: [PATCH] esArchiver: retry kibana config update (#43987) (#44169) * [services/es_archiver] retry uiSettings update * run x-pack-ciGroup7 30x times * Revert "run x-pack-ciGroup7 30x times" This reverts commit 80e199c3aa52bbab3ff388f74eaa3146ee69bb15. * [saved_object_api_integration/common/services] add retry service to the set * add retry service for x-pack api tests --- test/common/services/es_archiver.ts | 1 + test/common/services/kibana_server/extend_es_archiver.js | 6 ++++-- .../saved_object_api_integration/common/services/index.ts | 1 + x-pack/test/spaces_api_integration/common/config.ts | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/common/services/es_archiver.ts b/test/common/services/es_archiver.ts index cf8474662306b..e72bb49a76c0d 100644 --- a/test/common/services/es_archiver.ts +++ b/test/common/services/es_archiver.ts @@ -46,6 +46,7 @@ export function EsArchiverProvider({ getService, hasService }: FtrProviderContex KibanaServer.extendEsArchiver({ esArchiver, kibanaServer: getService('kibanaServer'), + retry: getService('retry'), defaults: config.get('uiSettings.defaults'), }); } diff --git a/test/common/services/kibana_server/extend_es_archiver.js b/test/common/services/kibana_server/extend_es_archiver.js index 30ac65b81bc6a..d934e6725a9f5 100644 --- a/test/common/services/kibana_server/extend_es_archiver.js +++ b/test/common/services/kibana_server/extend_es_archiver.js @@ -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; @@ -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; diff --git a/x-pack/test/saved_object_api_integration/common/services/index.ts b/x-pack/test/saved_object_api_integration/common/services/index.ts index 7c201af3ef469..dc2f023c0ba02 100644 --- a/x-pack/test/saved_object_api_integration/common/services/index.ts +++ b/x-pack/test/saved_object_api_integration/common/services/index.ts @@ -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, }; diff --git a/x-pack/test/spaces_api_integration/common/config.ts b/x-pack/test/spaces_api_integration/common/config.ts index 4c8cc3a8234ee..daf3b45982a34 100644 --- a/x-pack/test/spaces_api_integration/common/config.ts +++ b/x-pack/test/spaces_api_integration/common/config.ts @@ -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'), },