-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Cases] Total external references and persistable state attachments per case #162071
Conversation
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/response-ops-cases (Feature:Cases) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Could you please add an integration test to test the validation? You can bulk create the attachments with one call. It should be fast.
...lugins/cases/server/common/limiter_checker/limiters/persistableStateAndExternalReferences.ts
Outdated
Show resolved
Hide resolved
...s/cases/server/common/limiter_checker/limiters/persistableStateAndExternalReferences.test.ts
Outdated
Show resolved
Hide resolved
...s/cases/server/common/limiter_checker/limiters/persistableStateAndExternalReferences.test.ts
Outdated
Show resolved
Hide resolved
...s/cases/server/common/limiter_checker/limiters/persistableStateAndExternalReferences.test.ts
Outdated
Show resolved
Hide resolved
...s/cases/server/common/limiter_checker/limiters/persistableStateAndExternalReferences.test.ts
Outdated
Show resolved
Hide resolved
createAlertRequests, | ||
createExternalReferenceRequests, | ||
createPersistableStateRequests, | ||
createUserRequests, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: There are the same mocks in x-pack/plugins/cases/server/mocks.ts
or x-pack/test/cases_api_integration/common/lib/mock.ts
. Otherwise, we can extract these mock functions to x-pack/plugins/cases/server/mocks.ts
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good to me 👍 🎉
May be you can add an api integration test if possible.
Added integration tests for the internal |
service.countPersistableStateAndExternalReferenceAttachments({ caseId: 'test-id' }) | ||
).resolves.not.toThrow(); | ||
|
||
await expect(unsecuredSavedObjectsClient.find).toHaveBeenCalledWith( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think we need the await
here.
).resolves.not.toThrow(); | ||
|
||
await expect(unsecuredSavedObjectsClient.find).toHaveBeenCalledWith( | ||
expect.objectContaining({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should validate the filter passed to unsecuredSavedObjectsClient.find
. You can do
expect(unsecuredSavedObjectsClient.find.mock.calls[0][0]).toMatchInlineSnapshot(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @adcoelho |
…er case (elastic#162071) Connected to elastic#146945 ## Summary | Description | Limit | Done? | Documented? | ------------- | ---- | :---: | ---- | | Total number of attachments (external references and persistable state) per case | 100 | ✅ | No | ### Checklist Delete any items that are not applicable to this PR. - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### Release Notes A case can now only have 100 external references and persistable state(excluding files) attachments combined.
Connected to #146945
Summary
Checklist
Delete any items that are not applicable to this PR.
Release Notes
A case can now only have 100 external references and persistable state(excluding files) attachments combined.