Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const createListItem = async ({
body,
id,
index: listItemIndex,
refresh: 'wait_for',
});

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('crete_list_item_bulk', () => {
secondRecord,
],
index: LIST_ITEM_INDEX,
refresh: 'wait_for',
});
});

Expand Down Expand Up @@ -70,6 +71,7 @@ describe('crete_list_item_bulk', () => {
},
],
index: '.items',
refresh: 'wait_for',
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const deleteListItem = async ({
await callCluster('delete', {
id,
index: listItemIndex,
refresh: 'wait_for',
});
}
return listItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe('delete_list_item_by_value', () => {
},
},
index: '.items',
refresh: 'wait_for',
};
expect(options.callCluster).toBeCalledWith('deleteByQuery', deleteByQuery);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const deleteListItemByValue = async ({
},
},
index: listItemIndex,
refresh: 'wait_for',
});
return listItems;
};
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const updateListItem = async ({
},
id: listItem.id,
index: listItemIndex,
refresh: 'wait_for',
});
return {
created_at: listItem.created_at,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe('crete_list', () => {
body,
id: LIST_ID,
index: LIST_INDEX,
refresh: 'wait_for',
};
expect(options.callCluster).toBeCalledWith('index', expected);
});
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/lists/server/services/lists/create_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const createList = async ({
body,
id,
index: listIndex,
refresh: 'wait_for',
});
return {
id: response._id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/lists/server/services/lists/delete_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ export const deleteList = async ({
},
},
index: listItemIndex,
refresh: 'wait_for',
});

await callCluster('delete', {
id,
index: listIndex,
refresh: 'wait_for',
});
return list;
}
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/lists/server/services/lists/update_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const updateList = async ({
body: { doc },
id,
index: listIndex,
refresh: 'wait_for',
});
return {
created_at: list.created_at,
Expand Down
Loading