Skip to content

Commit

Permalink
Fix index existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
pheyos committed Nov 13, 2019
1 parent 7f02ff9 commit 8975164
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions x-pack/test/functional/services/transform_ui/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
import expect from '@kbn/expect';

import { isEmpty } from 'lodash';
import { FtrProviderContext } from '../../ftr_provider_context';

export function TransformAPIProvider({ getService }: FtrProviderContext) {
Expand All @@ -16,7 +15,7 @@ export function TransformAPIProvider({ getService }: FtrProviderContext) {
return {
async deleteIndices(indices: string) {
log.debug(`Deleting indices: '${indices}'...`);
if ((await es.indices.exists({ index: indices })) === false) {
if ((await es.indices.exists({ index: indices, allowNoIndices: false })) === false) {
log.debug(`Indices '${indices}' don't exist. Nothing to delete.`);
return;
}
Expand All @@ -29,11 +28,7 @@ export function TransformAPIProvider({ getService }: FtrProviderContext) {
.eql(true, 'Response for delete request should be acknowledged');

await retry.waitForWithTimeout(`'${indices}' indices to be deleted`, 30 * 1000, async () => {
const getRepsonse = await es.indices.get({
index: indices,
});

if (isEmpty(getRepsonse)) {
if ((await es.indices.exists({ index: indices, allowNoIndices: false })) === false) {
return true;
} else {
throw new Error(`expected indices '${indices}' to be deleted`);
Expand Down

0 comments on commit 8975164

Please sign in to comment.