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)
| 242 | // with various compression codecs can be correctly consumed and decompressed |
| 243 | // by Kafka's Java console consumer. |
| 244 | func 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 | |
| 268 | func kafkaVersionAtLeast(requiredVersion string) bool { |
| 269 | kafkaVersion := FunctionalTestEnv.KafkaVersion |
nothing calls this directly
no test coverage detected