-
Notifications
You must be signed in to change notification settings - Fork 49
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
[kyo-reactive-streams]: Remove un-necessary sleep time in test cases #939
base: main
Are you sure you want to change the base?
Conversation
@@ -225,17 +207,13 @@ abstract private class PublisherToSubscriberTest extends Test: | |||
publisher.subscribe(subscriber3) | |||
publisher.subscribe(subscriber4) | |||
} | |||
.andThen(Async.sleep(2.seconds)) | |||
.andThen(Async.sleep(1.seconds)) |
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.
could it be 100ms?
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.
This is more like a keep alive effect, the whole fiber will be interrupted below in 10.millis. So i dont think duration here is that important
Another way we can try to speed it up is by running tests in parallel. If you override |
After some playing around, I figured there are 2 solutions:
Global / parallelExecution := true
Global / concurrentRestrictions := Def.setting {
val par = parallelExecution.value
val max = EvaluateTask.SystemProcessors
Tags.limitAll(if (par) max else 1) ::
Tags.limit(Tags.ForkedTestGroup, if (par) max else 1) ::
Tags.exclusiveGroup(Tags.Clean) ::
Nil
}.value
|
@HollandDM I tried the config you mentioned but it still executes sequentially. While debugging, I noticed the TCK tests end up waiting for the timeout in multiple scenarios to wait for potential new events. If I set |
@fwbrasil weird, maybe testing environment only has 1 core? |
f4c480f
to
dad9d90
Compare
dad9d90
to
5a87bbb
Compare
fiber1 <- Async.run(subscriber1.stream.run.unit) | ||
fiber2 <- Async.run(subscriber2.stream.run.unit) | ||
fiber3 <- Async.run(subscriber3.stream.run.unit) | ||
fiber4 <- Async.run(subscriber4.stream.run.unit) |
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 used Fiber.gather
but it some time just got stuck, will do some more investigate later
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.
What's the goal here? Why not use parallelUnbounded
? Fiber.gather
is a recent addition, it'd be great if you could try to isolate in case there's an issue
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.
Can we merge this or are you're still planing to work on it? Thanks!
Originally,
Async.sleep
was used to mimic the real-life delay of a publisher/subscriber, but in thereactive-streams-tck
test cases, it provides little to no benefit while significantly slowing down the overall test. Additionally, a quick look atfs2
andzio
shows that they also do not use sleep in their test cases.This PR takes it a step further by removing
Async.sleep
from allkyo-reactive-stream
test cases. Since this feature is primarily about correctly combining effects, I believe that if individual components have been thoroughly tested, we can proceed with just the minimal testing.Furthermore, because
StreamSubscriber
has two strategies, I initially duplicated the tests for both. However, I think it suffices to randomly choose one strategy for each test in the suite.Overall, on my MacBook M3, the old tests took
1 minute and 37 seconds
to run, while the new tests complete in just34 seconds
.Aim to resolve #938