stoewer/go-nakadi

Fix racy tests and enable race detection on travis

Opened this issue · 8 comments

When tests are run with go test -race several race conditions are detected (see #7). Those race conditions must be fixed.

To avoid racy tests in the future the -race flag should be enabled for all tests in the .travis.yaml file.

@stoewer do you still need any help with this? I can give it a shot if you wish :)

Hi @marcosinger, that would be great!

@stoewer I'm having a bad time to configure Nakadi server on macOS.. after googling while it's running but I'm getting a duplicated key error running Go tests.. I can post a screenshot here if it helps, but do you have any clue on top your head about this issue?!

The integration tests and the tests examples create event types before the tests and remove them afterwards. However, if tests are interrupted the created event types or subscriptions might still exist on Nakadi. I guess this is the most likely explanation for the duplicated keys. The solution is just to stop Nakadi docker rm all existing Nakadi containers (especially postgres) and start a fresh instance of Nakadi.

You can check if the event type still exists with the GET /event-types endpoint. I hope this helps.

@marcosinger Are you still working on this one?

@stoewer I'm still getting a bunch of errors from Nakadi server and the tests aren't passing :(
I hacked the ./gradlew startNakadi script a little bit and some errors are gone, but it is not running smoothly.

To not block it you could get this issue back to you, if you wish.

@marcosinger The problem with Nakadi's docker compose setup is known but apparently not solved right now. There is a pull request that tries to solve it, but it still has errors.

Since I would really like to turn race detection on, I'd take this one over. If this is OK?

@stoewer go for it!