gaurav-narula commented on code in PR #15490:
URL: https://github.com/apache/kafka/pull/15490#discussion_r1516423400
##########
core/src/test/scala/unit/kafka/server/KafkaServerTest.scala:
##########
@@ -154,6 +159,25 @@ class KafkaServerTest extends QuorumTestHarness {
server.shutdown()
}
+ @Test
+ def testOfflineDirectoryOnMetadataCheckpointIOError(): Unit = {
+ val props = TestUtils.createBrokerConfigs(1, zkConnect).head
+ val kafkaConfig = KafkaConfig.fromProps(props)
+ val server: KafkaServer = TestUtils.createServer(kafkaConfig, new
MockTime, None, startup = false)
+
+ val spyValue: BrokerMetadataCheckpoint =
spy(server.brokerMetadataCheckpoints.head._2)
+ doThrow(new IOException()).when(spyValue).write(any())
+ server.brokerMetadataCheckpoints =
server.brokerMetadataCheckpoints.updated(server.brokerMetadataCheckpoints.head._1,
spyValue)
+
+ try {
+ server.startup()
+
assertTrue(server.logDirFailureChannel.hasOfflineLogDir(kafkaConfig.logDirs.head),
Review Comment:
~Could this flake? Might be worth enclosing in `TestUtils.waitUntilTrue`
perhaps?~
nvm, it's invoked in `startup()`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]