showuon commented on a change in pull request #11855: URL: https://github.com/apache/kafka/pull/11855#discussion_r825377329
########## File path: core/src/test/scala/unit/kafka/tools/ConsoleProducerTest.scala ########## @@ -123,4 +163,37 @@ class ConsoleProducerTest { assertEquals("console-producer", producerConfig.getString(ProducerConfig.CLIENT_ID_CONFIG)) } + + @Test + def testBatchSizeOverride(): Unit = { + val config = new ConsoleProducer.ProducerConfig(batchSizeOverride) + val producerConfig = new ProducerConfig(ConsoleProducer.producerProps(config)) + assertEquals("456", + producerConfig.getString(ProducerConfig.BATCH_SIZE_CONFIG)) + } + + @Test + def testBatchSizeSet(): Unit = { + val config = new ConsoleProducer.ProducerConfig(batchSizeSet) + val producerConfig = new ProducerConfig(ConsoleProducer.producerProps(config)) + assertEquals("123", + producerConfig.getString(ProducerConfig.BATCH_SIZE_CONFIG)) + } + + @Test + def testDefaultBatchSize(): Unit = { + val config = new ConsoleProducer.ProducerConfig(batchSizeDefault) + val producerConfig = new ProducerConfig(ConsoleProducer.producerProps(config)) + assertEquals(16*1024, + producerConfig.getInt(ProducerConfig.BATCH_SIZE_CONFIG)) + } + + @Test + def testBatchSizeNotSet(): Unit = { + val config = new ConsoleProducer.ProducerConfig(batchSizeNotSet) Review comment: I think this test can be renamed to `testBatchSizeNotSetAndMaxPartitionMemoryBytesSet` to be clear. And also the config variable name can be `batchSizeNotSetAndMaxPartitionMemoryBytesSet` ########## File path: core/src/test/scala/unit/kafka/tools/ConsoleProducerTest.scala ########## @@ -123,4 +163,37 @@ class ConsoleProducerTest { assertEquals("console-producer", producerConfig.getString(ProducerConfig.CLIENT_ID_CONFIG)) } + + @Test + def testBatchSizeOverride(): Unit = { + val config = new ConsoleProducer.ProducerConfig(batchSizeOverride) + val producerConfig = new ProducerConfig(ConsoleProducer.producerProps(config)) + assertEquals("456", + producerConfig.getString(ProducerConfig.BATCH_SIZE_CONFIG)) + } + + @Test + def testBatchSizeSet(): Unit = { + val config = new ConsoleProducer.ProducerConfig(batchSizeSet) Review comment: renamed to `testBatchSizeSetAndMaxPartitionMemoryBytesNotSet` And also the config variable name `batchSizeSet` -> `batchSizeSetAndMaxPartitionMemoryBytesNotSet` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org