[SIEM][Detection Engine][Lists] Adds "wait_for" to all the create, update, patch, delete endpoints

## Summary

* Adds "wait_for" to all the create, update, patch, and delete endpoints
* Ran some quick tests against import and the performance still looks acceptable
* Updates the unit tests to reflect the addition

### Checklist

- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
This commit is contained in:
Frank Hassanabad 2020-07-09 12:33:37 -06:00 committed by GitHub
parent e54729caf2
commit 4b4796ddbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 17 additions and 0 deletions

View file

@ -36,6 +36,7 @@ describe('crete_list_item', () => {
body,
id: LIST_ITEM_ID,
index: LIST_ITEM_INDEX,
refresh: 'wait_for',
};
expect(options.callCluster).toBeCalledWith('index', expected);
});

View file

@ -71,6 +71,7 @@ export const createListItem = async ({
body,
id,
index: listItemIndex,
refresh: 'wait_for',
});
return {

View file

@ -33,6 +33,7 @@ describe('crete_list_item_bulk', () => {
secondRecord,
],
index: LIST_ITEM_INDEX,
refresh: 'wait_for',
});
});
@ -70,6 +71,7 @@ describe('crete_list_item_bulk', () => {
},
],
index: '.items',
refresh: 'wait_for',
});
});
});

View file

@ -84,6 +84,7 @@ export const createListItemsBulk = async ({
await callCluster('bulk', {
body,
index: listItemIndex,
refresh: 'wait_for',
});
} catch (error) {
// TODO: Log out the error with return values from the bulk insert into another index or saved object

View file

@ -47,6 +47,7 @@ describe('delete_list_item', () => {
const deleteQuery = {
id: LIST_ITEM_ID,
index: LIST_ITEM_INDEX,
refresh: 'wait_for',
};
expect(options.callCluster).toBeCalledWith('delete', deleteQuery);
});

View file

@ -28,6 +28,7 @@ export const deleteListItem = async ({
await callCluster('delete', {
id,
index: listItemIndex,
refresh: 'wait_for',
});
}
return listItem;

View file

@ -52,6 +52,7 @@ describe('delete_list_item_by_value', () => {
},
},
index: '.items',
refresh: 'wait_for',
};
expect(options.callCluster).toBeCalledWith('deleteByQuery', deleteByQuery);
});

View file

@ -48,6 +48,7 @@ export const deleteListItemByValue = async ({
},
},
index: listItemIndex,
refresh: 'wait_for',
});
return listItems;
};

View file

@ -62,6 +62,7 @@ export const updateListItem = async ({
},
id: listItem.id,
index: listItemIndex,
refresh: 'wait_for',
});
return {
created_at: listItem.created_at,

View file

@ -52,6 +52,7 @@ describe('crete_list', () => {
body,
id: LIST_ID,
index: LIST_INDEX,
refresh: 'wait_for',
};
expect(options.callCluster).toBeCalledWith('index', expected);
});

View file

@ -67,6 +67,7 @@ export const createList = async ({
body,
id,
index: listIndex,
refresh: 'wait_for',
});
return {
id: response._id,

View file

@ -47,6 +47,7 @@ describe('delete_list', () => {
const deleteByQuery = {
body: { query: { term: { list_id: LIST_ID } } },
index: LIST_ITEM_INDEX,
refresh: 'wait_for',
};
expect(options.callCluster).toBeCalledWith('deleteByQuery', deleteByQuery);
});
@ -59,6 +60,7 @@ describe('delete_list', () => {
const deleteQuery = {
id: LIST_ID,
index: LIST_INDEX,
refresh: 'wait_for',
};
expect(options.callCluster).toHaveBeenNthCalledWith(2, 'delete', deleteQuery);
});

View file

@ -36,11 +36,13 @@ export const deleteList = async ({
},
},
index: listItemIndex,
refresh: 'wait_for',
});
await callCluster('delete', {
id,
index: listIndex,
refresh: 'wait_for',
});
return list;
}

View file

@ -55,6 +55,7 @@ export const updateList = async ({
body: { doc },
id,
index: listIndex,
refresh: 'wait_for',
});
return {
created_at: list.created_at,