karafka-testing icon indicating copy to clipboard operation
karafka-testing copied to clipboard

Incompatibility of Deserializer with Testing

Open mensfeld opened this issue 11 months ago • 0 comments

re: https://karafka.io/docs/Deserialization/#schema-registry_1

We are deserialising using Avro and Schema Registry. What we found was that the suggested AvroRegistryDeserializer code in the docs wasn't compatible with the Testing recommendations by Avro Turf.

Essentially the web mock stub wasn't able to stub the AvroTurf::Messaging.new client due to the client being intialised in the AVRO constant before the stub. Our workaround was to define a method instead, e.g: def avro @avro ||= AvroTurf::Messaging.new(...) end

This meant the client is initialised after the stub has been called.

mensfeld avatar Mar 12 '24 07:03 mensfeld