-
Notifications
You must be signed in to change notification settings - Fork 556
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
Create new StreamPlatformExtension #10036
Conversation
final var store = getStore(extensionContext); | ||
|
||
return (StreamProcessorTestContext) | ||
store.getOrComputeIfAbsent(FIELD_STATE, (key) -> new StreamProcessorTestContext()); |
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.
Mostly copied from Peters https://github.com/camunda/zeebe/blob/main/engine/src/test/java/io/camunda/zeebe/engine/util/ZeebeStateExtension.java I figured out that it is useful for also closing resources
private final WriteActor writeActor = new WriteActor(); | ||
private final ZeebeDbFactory zeebeDbFactory; | ||
|
||
public StreamPlatform( |
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.
Most parts are from TestStream and StreamProcessingComposite, I tried to clean up it already a bit
Test Results 813 files + 2 813 suites +2 1h 41m 53s ⏱️ + 5m 58s For more details on these failures, see this check. Results for commit 9728088. ± Comparison against base commit b8d1030. ♻️ This comment has been updated with latest results. |
To clarify, what's the goal for this PR? If I understood correctly, you're blocked because the test classes are too tightly coupled with the engine API? I'm just trying to figure out what kind of feedback do you want 😄 |
Since I have zero experience with writing extensions I would like to have first general feedback: This looks like a valid extension or it is crap. Furthemore, I would like to know whether you think this is something we want to use to test our StreamProcessor. I would like that we add some point test the stream processor separately from the engine, with just a mocked or dummy RecordProcessor, similar like what is done in the PR. To just validate the API and its guarantees, but without coupling to the real engine processing logic. Blocked is a hard word I have also other things I can do but yes it would help to make progress in this part. |
I see it as a first step in migrating our existing tests, so if you are ok with it and we merge it we can slowly migrate the other tests and delete at some point the old ones and hopefully at some point the old Rules. Of course, we can always iterate over the extension and StreamPlatform class (and we potentially also have to). |
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.
@Zelldon the extension looks good so far 👍
I think that we can clean it up here and there. Especially, the StreamPlatform
looks very similar to our existing classes. But I'm fine with improving it over time when we migrate more tests and know what we really need.
Thanks @saig0 for your review :) Yes makes sense since it is a copy/combination of them. As I said I also see that as a first step and we can improve but I think this helps us already to get the stone rolling :) |
bors r+ |
10036: Create new StreamPlatformExtension r=Zelldon a=Zelldon ## Description This is an attempt to create a new StreamPlatformExtension, which should allow us to replace the TestStreams, StreamProcessorComposite, and StreamProcessorRule. This is something that would help us to continue with cleaning up the engine/stream processing code (and tests). There was a recent attempt to remove the event applies from the stream processing interface, #9985 but this failed since several tests have high dependencies on how the engine and related stuff is built. They are highly coupled. This is just a first step and I would like to validate with you `@saig0` and `@npepinpe,` since I think you both are quite familiar with JUnit 5 extensions and our old rules. (Note: I'm a total junit 5 noob please bare with me.) _What the PR does:_ - Introduce a new class StreamPlatform (combination of [TestStreams](https://github.com/camunda/zeebe/blob/main/engine/src/test/java/io/camunda/zeebe/engine/util/TestStreams.java) and [StreamComposite](https://github.com/camunda/zeebe/blob/main/engine/src/test/java/io/camunda/zeebe/engine/util/StreamProcessingComposite.java)) - Introduce a new extension to create the StreamPlatform and make this available for tests - Created an example test which is a copy of [StreamProcessorReplayModeTest.java](https://github.com/camunda/zeebe/blob/main/engine/src/test/java/io/camunda/zeebe/engine/processing/streamprocessor/StreamProcessorReplayModeTest.java) In the test class we can see how it would look like and what the stream platform could provide us. Instead of always registering mocked typed processors in streamProcessors tests we just have on mocked RecordProcessor which can be use for verifications. I think this would simplify our tests a lot, since it is currently a lot of boilter plate which is mostly for the tests not interesting at all. Be aware that it currently only contains one test to show how it could look like and get early feedback. Please take a look and let me know what you think. <!-- Please explain the changes you made here. --> ## Related issues <!-- Which issues are closed by this PR or are related --> closes # Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
Build failed: |
bors r+ |
10036: Create new StreamPlatformExtension r=Zelldon a=Zelldon ## Description This is an attempt to create a new StreamPlatformExtension, which should allow us to replace the TestStreams, StreamProcessorComposite, and StreamProcessorRule. This is something that would help us to continue with cleaning up the engine/stream processing code (and tests). There was a recent attempt to remove the event applies from the stream processing interface, #9985 but this failed since several tests have high dependencies on how the engine and related stuff is built. They are highly coupled. This is just a first step and I would like to validate with you `@saig0` and `@npepinpe,` since I think you both are quite familiar with JUnit 5 extensions and our old rules. (Note: I'm a total junit 5 noob please bare with me.) _What the PR does:_ - Introduce a new class StreamPlatform (combination of [TestStreams](https://github.com/camunda/zeebe/blob/main/engine/src/test/java/io/camunda/zeebe/engine/util/TestStreams.java) and [StreamComposite](https://github.com/camunda/zeebe/blob/main/engine/src/test/java/io/camunda/zeebe/engine/util/StreamProcessingComposite.java)) - Introduce a new extension to create the StreamPlatform and make this available for tests - Created an example test which is a copy of [StreamProcessorReplayModeTest.java](https://github.com/camunda/zeebe/blob/main/engine/src/test/java/io/camunda/zeebe/engine/processing/streamprocessor/StreamProcessorReplayModeTest.java) In the test class we can see how it would look like and what the stream platform could provide us. Instead of always registering mocked typed processors in streamProcessors tests we just have on mocked RecordProcessor which can be use for verifications. I think this would simplify our tests a lot, since it is currently a lot of boilter plate which is mostly for the tests not interesting at all. Be aware that it currently only contains one test to show how it could look like and get early feedback. Please take a look and let me know what you think. <!-- Please explain the changes you made here. --> ## Related issues <!-- Which issues are closed by this PR or are related --> closes # Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
Build failed: |
bors r+ |
Build succeeded: |
Description
This is an attempt to create a new StreamPlatformExtension, which should allow us to replace the TestStreams, StreamProcessorComposite, and StreamProcessorRule. This is something that would help us to continue with cleaning up the engine/stream processing code (and tests). There was a recent attempt to remove the event applies from the stream processing interface, #9985 but this failed since several tests have high dependencies on how the engine and related stuff is built. They are highly coupled.
This is just a first step and I would like to validate with you @saig0 and @npepinpe, since I think you both are quite familiar with JUnit 5 extensions and our old rules. (Note: I'm a total junit 5 noob please bare with me.)
What the PR does:
In the test class we can see how it would look like and what the stream platform could provide us. Instead of always registering mocked typed processors in streamProcessors tests we just have on mocked RecordProcessor which can be use for verifications. I think this would simplify our tests a lot, since it is currently a lot of boilter plate which is mostly for the tests not interesting at all.
Be aware that it currently only contains one test to show how it could look like and get early feedback.
Please take a look and let me know what you think.
Related issues
closes #
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
backport stable/1.3
) to the PR, in case that fails you need to create backports manually.Testing:
Documentation:
Please refer to our review guidelines.