-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Bug: Kafka doesn't work with t.Parallel() #1038
Comments
Ah, that's because the port is set explicitly in NamedPort; which is needed, because Kafka needs to have the same port outside as inside for some reason. I have fixed it in a local fork by holding a global map with ports in kafka preset, which is changed at the time of running kafka.Preset(); so each kafka.Preset() has a different port; and also added a new function I have a local fork because of other kafka issues (see other PRs) so it's fine for now for me |
The code:
FreePort needs to be run manually |
Thanks for reporting this @karelbilek. Yes it's a limitation of the Kafka preset. I think your solution is nice, and if more people would like to run kafka presets in parallel, it would be great to have it merged. Closing this for now. |
I was thinking how to do this in a nice, non-hacky way. The only thing I thought about is to make a different Docker image than the one you use, which would start some small HTTP service (or some other way to pass data there - unix signal? files?), we would send the service the external port after the Docker is started (because we do know the port at that point), and only then would it start Kafka (it would set the env var and actually start the thing) It would mean writing our own Docker for kafka, based on the existing one but with this additional delay. (Or, maybe it would be possible to use the one that is there and somehow in a hacky way start this HTTP server/bash script/something there.... will experiment later.) |
Describe the bug
Kafka doesn't work with t.Parallel
Not only does it not work when I do t.Parallel in more tests, that set up and teardown docker. It also doesn't work if I use same preset in multiple packages (I need to use
-p 1
in that case, which makes all test run on 1 core)Other presets do work, so it's strange that this one doesn't
To Reproduce
This starts 10 tests, all start kafka, and then tear it down. All in parallel. Most of them will fail.
Expected behavior
Test will work.
System (please complete the following information):
The text was updated successfully, but these errors were encountered: