Skip to content

Commit

Permalink
Change the cases limit to 1000. Fix merging conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
adcoelho committed Jul 4, 2023
1 parent 8947804 commit 2cc4628
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/cases/common/api/cases/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ export const GetCategoriesResponseRt = rt.array(rt.string);
export const GetReportersResponseRt = rt.array(UserRt);

export const CasesBulkGetRequestRt = rt.strict({
ids: limitedArraySchema(rt.string, 1, MAX_BULK_GET_CASES, 'ids'),
ids: limitedArraySchema({ codec: rt.string, min: 1, max: MAX_BULK_GET_CASES, fieldName: 'ids' }),
});

export const CasesBulkGetResponseRt = rt.strict({
Expand Down
7 changes: 6 additions & 1 deletion x-pack/plugins/cases/common/api/cases/comment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@ export const FindCommentsQueryParamsRt = rt.exact(
export const BulkCreateCommentRequestRt = rt.array(CommentRequestRt);

export const BulkGetAttachmentsRequestRt = rt.strict({
ids: limitedArraySchema(rt.string, 1, MAX_BULK_GET_ATTACHMENTS, 'ids'),
ids: limitedArraySchema({
codec: rt.string,
min: 1,
max: MAX_BULK_GET_ATTACHMENTS,
fieldName: 'ids',
}),
});

export const BulkGetAttachmentsResponseRt = rt.strict({
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/cases/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const MAX_ALERTS_PER_CASE = 1000 as const;
export const MAX_DOCS_PER_PAGE = 10000 as const;
export const MAX_BULK_GET_ATTACHMENTS = 100 as const;
export const MAX_CONCURRENT_SEARCHES = 10 as const;
export const MAX_BULK_GET_CASES = 100 as const;
export const MAX_BULK_GET_CASES = 1000 as const;
export const MAX_COMMENTS_PER_PAGE = 100 as const;
export const MAX_CATEGORY_FILTER_LENGTH = 100 as const;
export const MAX_TAGS_FILTER_LENGTH = 100 as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import expect from '@kbn/expect';
import { CommentType } from '@kbn/cases-plugin/common';
import { MAX_BULK_GET_CASES } from '@kbn/cases-plugin/common/constants';
import { getPostCaseRequest, postCaseReq } from '../../../../common/lib/mock';
import { FtrProviderContext } from '../../../../common/ftr_provider_context';
import {
Expand Down Expand Up @@ -111,10 +112,10 @@ export default ({ getService }: FtrProviderContext): void => {
});

describe('errors', () => {
it('400s when requesting more than 100 cases', async () => {
it(`400s when requesting more than ${MAX_BULK_GET_CASES} cases`, async () => {
await bulkGetCases({
supertest,
ids: Array(101).fill('foobar'),
ids: Array(MAX_BULK_GET_CASES + 1).fill('foobar'),
expectedHttpCode: 400,
});
});
Expand Down

0 comments on commit 2cc4628

Please sign in to comment.