-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Filebeat pytest improvements #30103
Filebeat pytest improvements #30103
Conversation
This surfaces which file the test was waiting to see documents from. Otherwise you just get a numeric test failure with no clear idea of which file isn't ingesting as expected.
For example: ``` INTEGRATION_TESTS=1 BEAT_STRICT_PERMS=false TESTING_FILEBEAT_MODULES=elasticsearch TESTING_FILEBEAT_FILESETS=slowlog TESTING_FILEBEAT_FILEPATTERN=es_indexing_slowlog.800.log ES_PASS=changeme pytest tests/system/test_modules.py -v --full-trace ```
By seeing the event, we can more easily identify which log file it's coming from.
Pinging @elastic/integrations (Team:Integrations) |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
@@ -107,7 +107,7 @@ def load_fileset_test_cases(): | |||
continue | |||
|
|||
test_files = glob.glob(os.path.join(modules_dir, module, | |||
fileset, "test", "*.log")) | |||
fileset, "test", os.getenv("TESTING_FILEBEAT_FILEPATTERN", "*.log"))) |
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.
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.
Agree
I think we should rethink how and why we introduce variables in the first place. The problem today is there are multiple ways to run tests that support or require different side effects.
I strongly think the test cli should give me all the required information for options without looking in the documentation.
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.
Definitely agreed.
Not sure if pytest offers something like this directly. mage pythonIntegTest
has inline help, but does a lot of extra work (15min for my laptop).
I guess maybe one option would be a lighter mage target with these options covered in the inline help.
In working on the tests I also noticed some similarity with metricbeat testdata
integration tests. For example:
func TestFetchEventContents(t *testing.T) { |
If we did these filebeat module tests as regular golang test cases, stuff like TESTING_FILEBEAT_FILEPATTERN
would just be go test -run (pattern)
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.
Having quicker mage
task is an option.
I would like to remove all python integration tests and use a single language.
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 feel that. 🧡
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.
Change LGTM
* Include the test_file as wait_until name * Support TESTING_FILEBEAT_FILEPATTERN to test a single ingest file * Include full event on "not documented" case (cherry picked from commit 3ddf236)
* Include the test_file as wait_until name * Support TESTING_FILEBEAT_FILEPATTERN to test a single ingest file * Include full event on "not documented" case (cherry picked from commit 3ddf236) Co-authored-by: Mat Schaffer <[email protected]>
What does this PR do?
Provides a few improvements to the filebeat ingest pytests.
Why is it important?
Makes it easier to write and maintain filebeat pytests
Checklist
I have commented my code, particularly in hard-to-understand areasI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Related issues
I ended up writing these as part of #30018 but didn't want to mix them into that PR.