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

a home for test utils? #61

Closed
TimPigden opened this issue Nov 11, 2019 · 3 comments
Closed

a home for test utils? #61

TimPigden opened this issue Nov 11, 2019 · 3 comments

Comments

@TimPigden
Copy link
Contributor

adapting the tests for zio-test showed a need for non-trivial support methods to provide a proper providedManagedShared environment for running the tests. It's hard to see how anyone using the library and zio-test will not have the same issues. For example, practically everything needs the live clock.
Is there a place for some sort of kafka-test-util?

@adamgfraser
Copy link
Contributor

@TimPigden One thing that might be worth thinking about here is if you want to do something like:

trait KafkaSpec extends RunnableSpec

Right now you are using DefaultRunnableSpec which provides a TestEnvironment, so you need to use provideManagedShared to build an environment that also has the Kafka service (you can probably make this a little more efficient now that RC17 is out using provideSomeManagedShared). This definitely works, but the other approach you could consider is creating your own KafkaSpec trait that automatically provides the TestEnvironment with the Kafka service.

To do that you would extend RunnableSpec like shown above and then implement your own TestRunner. You can use make a TestRunner by providing a TestExecutor, which is just a function that knows how to execute specs requiring a certain environment. The default implementation in DefaultTestExecutor.scala is only about 20 lines of code.

I'm not sure if this is better or not but it is something that might be worth thinking about.

@tewecske
Copy link
Contributor

Now there is a place for test utils :)

@erikvanoosten
Copy link
Collaborator

Test support is available now via the zio-kafka-test-utils library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants