Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/scala/kafka/log/LogConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ object LogConfig {
KafkaConfig.LogPreAllocateProp)
.define(MessageFormatVersionProp, STRING, Defaults.MessageFormatVersion, MEDIUM, MessageFormatVersionDoc,
KafkaConfig.LogMessageFormatVersionProp)
.define(MessageTimestampTypeProp, STRING, Defaults.MessageTimestampType, MEDIUM, MessageTimestampTypeDoc,
.define(MessageTimestampTypeProp, STRING, Defaults.MessageTimestampType, in("CreateTime", "LogAppendTime"), MEDIUM, MessageTimestampTypeDoc,
KafkaConfig.LogMessageTimestampTypeProp)
.define(MessageTimestampDifferenceMaxMsProp, LONG, Defaults.MessageTimestampDifferenceMaxMs,
atLeast(0), MEDIUM, MessageTimestampDifferenceMaxMsDoc, KafkaConfig.LogMessageTimestampDifferenceMaxMsProp)
Expand Down
20 changes: 20 additions & 0 deletions core/src/test/scala/unit/kafka/admin/TopicCommandTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,24 @@ class TopicCommandTest extends ZooKeeperTestHarness with Logging with RackAwareT
assertTrue(output.contains(topic) && output.contains(markedForDeletionList))
}

@Test
def testInvalidTopicLevelConfig(): Unit = {
val brokers = List(0)
TestUtils.createBrokersInZk(zkClient, brokers)

val topic = "test"
val numPartitions = 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need these variables since they're just used once.


// create the topic
try {
val createOpts = new TopicCommandOptions(
Array("--partitions", numPartitions.toString, "--replication-factor", "1", "--topic", topic,
"--config", "message.timestamp.type=boom"))
TopicCommand.createTopic(zkClient, createOpts)
fail("Expected exception on invalid topic-level config.")
} catch {
case e: Exception => // topic create should fail due to the invalid config
}
}

}