Add simplified integration framework #42450
Open
+1,430
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
That can be used for running Beats binaries in integration tests.
This framework has a simplified API comparing to the existing one and uses a more efficient way to search for logs in the output of the command.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Motivation
Recently I needed to write a few integration tests that run the Filebeat binary and I found the existing integration framework very cumbersome. It requires a lot of boilerplate code and the purpose of any framework is to illuminate that.
Since we're going to eventually migrate all the integration tests written in Python, we need to have a very simple tool for writing integration tests that should cover most of the test-cases.
Both frameworks (old and new) can co-exist for now.
Pros
This design has a few advantages over the previous one:
For example, test similar to the one written in the older framework:
https://github.com/elastic/beats/blob/main/filebeat/tests/integration/filebeat_test.go#L37-L94
Can be replaced with this:
Additionally, it also includes validation that:
Another example, this time we expect Beat to crash:
Cons
Current functionality
Basic Assertions
Filebeat-specific Assertions
Reporting
Config