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

[7.x] [SIEM] [Detection Engine] Increase unit test coverage (#58274) #58480

Merged
merged 3 commits into from
Feb 26, 2020

Conversation

dhurley14
Copy link
Contributor

Backports the following commits to 7.x:

* updates read privileges route tests

* fixes test for 404 when alertsClient is not present, adds new test for catching errors at the route level for prepackaged rules route

* fixes test for happy path on create rules bulk route (missing mock resulted in 200, but was still throwing an error), adds tests for covering case where a rule with a matching rule id is found to have already existed, adds a test covering the case where createRules throws an error and that error is caught in the catch block, and appears in the response

* adds more jest functions to beforeEach to ensure mockImplementation state used by spyOn is not carried over between tests, increases test coverage for create rules route

* updates unit test coverage for delete rules route and bulk delete

* increase unit test coverage for find_rules_route

* add test case to get_prepackaged_rules where findRules throws an error

* adds unit test for missing alertsClient in patch_rules_bulk route

* adds unit test coverage for transform error and pathRules throwing an error on patch rules route

* adds unit test coverage for rule not found, transform error, and readRules throws an error on read_rules_route

* adds unit test coverage for update rules (bulk) routes

* increases unit test coverage for open close signals route

* updates coverage for signals query route

* adds unit tests for rules status route, updates utils test coverage. Removed unreachable code.

* updates test coverage, removes usage of pipes from ndjson to stream conversion and returns arrays of tranformers to be used in createPromiseFromStreams so that unhandled promise rejections can be handled appropriately.

* fixes type errors

* fix bug on transform when rulestatus saved objects array is empty because we are no longer passing in the current status, we are passing in the whole saved object.

* adds unit test for when readRules throws an error inside of get export by object ids

* adds unit tests for catching errors on read rules and fixes property undefined bug in catch block

* removes unused function from utils

* adds the 'else' clause back to the getTupleDuplicateErrorsAndUniqueRules function and adds a test case for when an attempt to import rules with missing ruleIds is made, and the expected outcome.
@dhurley14
Copy link
Contributor Author

@elasticmachine merge upstream

@dhurley14
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@dhurley14 dhurley14 merged commit f367a11 into elastic:7.x Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants