MCPcopy Create free account
hub / github.com/IBM/sarama / TestJavaProducerCompressionRoundTrip

Function TestJavaProducerCompressionRoundTrip

functional_java_interop_test.go:217–239  ·  view source on GitHub ↗

TestJavaProducerCompressionRoundTrip tests that messages produced by Kafka's Java console producer with various compression codecs can be correctly consumed and decompressed by Sarama.

(t *testing.T)

Source from the content-addressed store, hash-verified

215// console producer with various compression codecs can be correctly consumed and
216// decompressed by Sarama.
217func TestJavaProducerCompressionRoundTrip(t *testing.T) {
218 skipIfExistingEnvironment(t)
219 setupFunctionalTest(t)
220 defer teardownFunctionalTest(t)
221
222 for _, tc := range compressionTests {
223 t.Run(tc.codec.String(), func(t *testing.T) {
224 checkKafkaVersion(t, tc.minKafka)
225
226 expected := []string{
227 fmt.Sprintf("Message 1 with %s compression", tc.codec),
228 "Message 2",
229 "Message 3",
230 }
231
232 initialOffset := endOffsetForPartition(t, "test.1", 0)
233 produceWithJava(t, "test.1", tc.codec, expected)
234 actual := consumeWithSarama(t, "test.1", initialOffset, len(expected))
235
236 require.Equal(t, expected, actual)
237 })
238 }
239}
240
241// TestJavaConsumerCompressionRoundTrip tests that messages produced by Sarama
242// with various compression codecs can be correctly consumed and decompressed

Callers

nothing calls this directly

Calls 9

setupFunctionalTestFunction · 0.85
teardownFunctionalTestFunction · 0.85
checkKafkaVersionFunction · 0.85
endOffsetForPartitionFunction · 0.85
produceWithJavaFunction · 0.85
consumeWithSaramaFunction · 0.85
RunMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected