pulsar-client-go icon indicating copy to clipboard operation
pulsar-client-go copied to clipboard

[Mocks] Add Mock Server Implementation

Open jayshrivastava opened this issue 1 year ago • 3 comments

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

jayshrivastava avatar Jan 31 '24 21:01 jayshrivastava

If we provide a Make command to run a docker standalone pulsar service locally, will the problem be solved?

crossoverJie avatar Mar 12 '24 15:03 crossoverJie

@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

jayshrivastava avatar Mar 12 '24 20:03 jayshrivastava

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.

geniusjoe avatar Mar 25 '24 07:03 geniusjoe