You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but when I run my test, my sarama.ConsumerGroupHandler won't invoke the Setup function. I suppose this is caused by the incomplete mocked handlers in SetHandlerByMap, this log suggested that:
I tried to create the mock by myself by trying to implement sarama.MockResponse interface but it is cannot be done because func For( ) needs a sarama.versionedDecoder parameter which is not exported, also the return value is expected to be a sarama.encoder which is also not exported.
Should we create a new factory function to mock JoinGroupResponse ? or is there any other suggestion?
Thanks
The text was updated successfully, but these errors were encountered:
@MichaHoffmann yes a factory function can also resolve this. I just looked at #1631 it seems it tries to solve this similar issue #1577 , maybe you can extend that PR because it got no activity for some months now. I might should close my issue then?
Versions
Configuration
What configuration values are you using for Sarama and Kafka?
Logs
logs: CLICK ME
Problem Description
I am using
sarama.NewClient
and thensarama.NewConsumerGroupFromClient
to create a consumer group, it works smoothly when compiled.Now the question is on the testing side, I want to be able to test my function safely using mocks. I've write the test like so:
func_test.go: CLICK
but when I run my test, my
sarama.ConsumerGroupHandler
won't invoke theSetup
function. I suppose this is caused by the incomplete mocked handlers inSetHandlerByMap
, this log suggested that:JoinGroupRequest is ignored: CLICK
I tried to create the mock by myself by trying to implement
sarama.MockResponse
interface but it is cannot be done because funcFor( )
needs asarama.versionedDecoder
parameter which is not exported, also the return value is expected to be asarama.encoder
which is also not exported.Should we create a new factory function to mock JoinGroupResponse ? or is there any other suggestion?
Thanks
The text was updated successfully, but these errors were encountered: