Skip to content

Commit

Permalink
revert code removal, apparently was used (?)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Aug 26, 2020
1 parent 67e57fb commit 6948185
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/server/ui_settings/integration_tests/lib/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface AllServices {
savedObjectsClient: SavedObjectsClientContract;
callCluster: LegacyAPICaller;
uiSettings: IUiSettingsClient;
deleteKibanaIndex: typeof deleteKibanaIndex;
}

let services: AllServices;
Expand All @@ -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;
Expand All @@ -82,6 +97,7 @@ export function getServices() {
callCluster,
savedObjectsClient,
uiSettings,
deleteKibanaIndex,
};

return services;
Expand Down

0 comments on commit 6948185

Please sign in to comment.