From 69481850a0c098cf2cf6eb3113efc3b63c25bc0a Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Wed, 26 Aug 2020 11:12:35 +0200 Subject: [PATCH] revert code removal, apparently was used (?) --- .../ui_settings/integration_tests/lib/servers.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/core/server/ui_settings/integration_tests/lib/servers.ts b/src/core/server/ui_settings/integration_tests/lib/servers.ts index b4cfc3c1efe8b..ea462291059a5 100644 --- a/src/core/server/ui_settings/integration_tests/lib/servers.ts +++ b/src/core/server/ui_settings/integration_tests/lib/servers.ts @@ -39,6 +39,7 @@ interface AllServices { savedObjectsClient: SavedObjectsClientContract; callCluster: LegacyAPICaller; uiSettings: IUiSettingsClient; + deleteKibanaIndex: typeof deleteKibanaIndex; } let services: AllServices; @@ -61,6 +62,20 @@ export async function startServers() { kbnServer = kbn.kbnServer; } +async function deleteKibanaIndex(callCluster: LegacyAPICaller) { + const kibanaIndices = await callCluster('cat.indices', { index: '.kibana*', format: 'json' }); + const indexNames = kibanaIndices.map((x: any) => x.index); + if (!indexNames.length) { + return; + } + await callCluster('indices.putSettings', { + index: indexNames, + body: { index: { blocks: { read_only: false } } }, + }); + await callCluster('indices.delete', { index: indexNames }); + return indexNames; +} + export function getServices() { if (services) { return services; @@ -82,6 +97,7 @@ export function getServices() { callCluster, savedObjectsClient, uiSettings, + deleteKibanaIndex, }; return services;