pulsar-client-go
pulsar-client-go copied to clipboard
[Mocks] Add Mock Server Implementation
Is your feature request related to a problem? Please describe. I would like to unit test this library, but there is no mock server implementation. Testing requires me to start a standalone pulsar server and emit to it.
Describe the solution you'd like I would like to be able to write unit tests without starting up a pulsar server. I want to ensure the server receives messages in the right order
If we provide a Make command to run a docker standalone pulsar service locally, will the problem be solved?
@crossoverJie I think this is not great because it would make our unit tests more expensive to run. In the google pubsub sdk, there's go/pkg/mod/cloud.google.com/go/[email protected]/pstest/fake.go a mock server which can be injected https://github.com/cockroachdb/cockroach/blob/47106211a8b522610adf05465f095c124a3d33a2/pkg/ccl/changefeedccl/testfeed_test.go#L2305-L2308
Pulsar broker and bookie is written in Java. And I think it will be a little complicated if we mock broker code in the unit test.