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

Function TestJavaConsumerCompressionRoundTrip

functional_java_interop_test.go:244–266  ·  view source on GitHub ↗

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

(t *testing.T)

Source from the content-addressed store, hash-verified

242// with various compression codecs can be correctly consumed and decompressed
243// by Kafka's Java console consumer.
244func TestJavaConsumerCompressionRoundTrip(t *testing.T) {
245 skipIfExistingEnvironment(t)
246 setupFunctionalTest(t)
247 defer teardownFunctionalTest(t)
248
249 for _, tc := range compressionTests {
250 t.Run(tc.codec.String(), func(t *testing.T) {
251 checkKafkaVersion(t, tc.minKafka)
252
253 expected := []string{
254 fmt.Sprintf("Message 1 with %s compression", tc.codec),
255 "Message 2",
256 "Message 3",
257 }
258
259 initialOffset := endOffsetForPartition(t, "test.1", 0)
260 produceWithSarama(t, "test.1", tc.codec, expected)
261 actual := consumeWithJava(t, "test.1", initialOffset, len(expected))
262
263 require.Equal(t, expected, actual)
264 })
265 }
266}
267
268func kafkaVersionAtLeast(requiredVersion string) bool {
269 kafkaVersion := FunctionalTestEnv.KafkaVersion

Callers

nothing calls this directly

Calls 9

setupFunctionalTestFunction · 0.85
teardownFunctionalTestFunction · 0.85
checkKafkaVersionFunction · 0.85
endOffsetForPartitionFunction · 0.85
produceWithSaramaFunction · 0.85
consumeWithJavaFunction · 0.85
RunMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected