MCPcopy
hub / github.com/IBM/sarama / TestJavaProducerCompressionRoundTrip

Function TestJavaProducerCompressionRoundTrip

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

Callers

nothing calls this directly

Calls 8

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