Skip to content
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

Replace sleep in tests with Promises #1389

Open
svroonland opened this issue Nov 16, 2024 · 1 comment
Open

Replace sleep in tests with Promises #1389

svroonland opened this issue Nov 16, 2024 · 1 comment
Labels
good first issue Good for newcomers

Comments

@svroonland
Copy link
Collaborator

There's a number of zio-kafka tests that are doing sleeps to wait for some condition to occur, which have a high risk of being flaky.

A better solution is to use a Promise to signal that some condition has occurred and await it somewhere else. Examples in the can stop one stream while keeping another one running test in ConsumerSpec

@svroonland svroonland added the good first issue Good for newcomers label Nov 16, 2024
@svroonland
Copy link
Collaborator Author

Followup of #1388

erikvanoosten pushed a commit that referenced this issue Nov 23, 2024
This change improves the reliability of tests in
`ConsumerSpec.scala` by replacing the use of `ZIO.sleep` with
synchronization primitives such as `Promise` and `Ref`. The previous
implementation relied on arbitrary sleep durations to wait for certain
conditions, which could lead to non-deterministic behavior and flakiness
in the tests.

Follow up of #1389.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant