Skip to content

Use Elasticsearch events for automated testing.#289

Merged
yashtewari merged 2 commits into
elastic:mainfrom
yashtewari:automated-tests-switch-to-elasticsearch
Jul 20, 2022
Merged

Use Elasticsearch events for automated testing.#289
yashtewari merged 2 commits into
elastic:mainfrom
yashtewari:automated-tests-switch-to-elasticsearch

Conversation

@yashtewari

@yashtewari yashtewari commented Jul 19, 2022

Copy link
Copy Markdown
Contributor

Use of OPA decision logs to match findings against expected findings is now deprecated.

The deprecated function get_evaluation has been renamed to get_logs_evaluation but not yet deleted, because it's still useful for debugging.

Resolves: https://github.com/elastic/security-team/issues/4049

@yashtewari yashtewari requested a review from a team as a code owner July 19, 2022 08:21
@mergify

mergify Bot commented Jul 19, 2022

Copy link
Copy Markdown
Contributor

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b automated-tests-switch-to-elasticsearch upstream/automated-tests-switch-to-elasticsearch
git merge upstream/main
git push upstream automated-tests-switch-to-elasticsearch

@mergify

mergify Bot commented Jul 19, 2022

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label. Could you fix it @yashtewari? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
    NOTE: backport-skip has been added to this pull request.

@yashtewari yashtewari force-pushed the automated-tests-switch-to-elasticsearch branch from c7ec7b2 to 737f116 Compare July 19, 2022 08:25
@oren-zohar oren-zohar self-requested a review July 19, 2022 08:44
@github-actions

Copy link
Copy Markdown

@yashtewari yashtewari force-pushed the automated-tests-switch-to-elasticsearch branch 2 times, most recently from 71d8400 to 36909be Compare July 19, 2022 10:57
@github-actions

Copy link
Copy Markdown

@oren-zohar oren-zohar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@@ -2,6 +2,7 @@
This module provides input / output manipulations on streams / files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you edited those files, can you please fix the linter comments from running

flake8 --ignore=E501,E126,E123 commonlib

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@yashtewari yashtewari force-pushed the automated-tests-switch-to-elasticsearch branch from 36909be to 94b3303 Compare July 20, 2022 06:31
@github-actions

Copy link
Copy Markdown

1 similar comment
@github-actions

Copy link
Copy Markdown

@yashtewari yashtewari requested a review from DaveSys911 July 20, 2022 08:02
Use of OPA decision logs match findings against expected findings
is now deprecated.
@yashtewari yashtewari force-pushed the automated-tests-switch-to-elasticsearch branch from a05b1f4 to 7208a9e Compare July 20, 2022 10:00
@yashtewari yashtewari enabled auto-merge (squash) July 20, 2022 10:14
@github-actions

Copy link
Copy Markdown

1 similar comment
@github-actions

Copy link
Copy Markdown

@DaveSys911 DaveSys911 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, please consider addressing the comments on subsequent prs
as part of https://github.com/elastic/security-team/issues/4296 perhaps.

from munch import Munch, munchify


def get_events_from_index(elastic_client, index_name: str, rule_tag: str, time_after: datetime) -> list[Munch]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces an additional function that interfaces with ES, I suggest considering moving it to commonlib/elastic_wrapper.py.

In addition, it might be a good idea to patch up the tests in [tests/integration] (https://github.com/elastic/cloudbeat/blob/main/tests/integration/tests/test_cloudbeat_integration.py) to access ES using the same method.

The current convention is a bit confusing.

@yashtewari yashtewari merged commit adb421d into elastic:main Jul 20, 2022
@oren-zohar

Copy link
Copy Markdown
Collaborator

Can you also please open a ticket for the debug mode degradation?

orouz pushed a commit to orouz/cloudbeat that referenced this pull request Sep 6, 2023
orestisfl pushed a commit to orestisfl/cloudbeat that referenced this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants