wind-c / comqtt

A lightweight, high-performance go mqtt server(v3.0|v3.1.1|v5.0) supporting distributed cluster
MIT License
972 stars 53 forks source link

add a mock for kafka and use it for testing #48

Closed perbu closed 1 year ago

perbu commented 1 year ago
wind-c commented 1 year ago

good job.

wind-c commented 1 year ago

I can't find a good mock mysql and postgresql lib. Do you have any good suggestions?

perbu commented 1 year ago

I can't find a good mock mysql and postgresql lib. Do you have any good suggestions?

In my repo I've made the following change. It'll check if there is a local mysqld or postgresql on the host. If there isn't a sql server on the host it'll t.Skip() the tests that need the server - since those will fail anyway.

This will allow us to keep the tests those tests, but without having the tests turn up red if there is no sql server running.

I'm a bit skeptical of mocking sql servers. The mocks are very fragile. We could look into having the tests spin up mysql and postgresql servers, but I suggest we wait with that until we have more extensive testing of those components in place.

Sounds good with you?