[GitHub] [kafka] divijvaidya commented on a diff in pull request #13868: MINOR: Close ReplicaManager correctly in ReplicaManagerTest
divijvaidya commented on code in PR #13868: URL: https://github.com/apache/kafka/pull/13868#discussion_r1235807347 ## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ## @@ -75,31 +75,31 @@ import org.mockito.invocation.InvocationOnMock import org.mockito.stubbing.Answer import org.mockito.{ArgumentCaptor, ArgumentMatchers} import org.mockito.ArgumentMatchers.{any, anyInt, anyMap, anySet, anyString} -import org.mockito.Mockito.{doReturn, mock, mockConstruction, never, reset, times, verify, verifyNoMoreInteractions, when} +import org.mockito.Mockito.{doReturn, mock, mockConstruction, never, reset, spy, times, verify, verifyNoMoreInteractions, when} import scala.collection.{Map, Seq, mutable} import scala.compat.java8.OptionConverters.RichOptionForJava8 import scala.jdk.CollectionConverters._ class ReplicaManagerTest { - val topic = "test-topic" - val topicId = Uuid.randomUuid() - val topicIds = scala.Predef.Map("test-topic" -> topicId) - val topicNames = scala.Predef.Map(topicId -> "test-topic") - val time = new MockTime - val scheduler = new MockScheduler(time) - val metrics = new Metrics - var alterPartitionManager: AlterPartitionManager = _ - var config: KafkaConfig = _ - var quotaManager: QuotaManagers = _ - var mockRemoteLogManager: RemoteLogManager = _ + private val topic = "test-topic" + private val topicId: Uuid = Uuid.randomUuid() Review Comment: Removed the annotation. -- 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
[GitHub] [kafka] divijvaidya commented on a diff in pull request #13868: MINOR: Close ReplicaManager correctly in ReplicaManagerTest
divijvaidya commented on code in PR #13868: URL: https://github.com/apache/kafka/pull/13868#discussion_r1235094378 ## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ## @@ -4935,12 +4991,17 @@ class ReplicaManagerTest { topicPartition, leaderEpoch + leaderEpochIncrement, followerBrokerId, leaderBrokerId, countDownLatch, expectTruncation = false, localLogOffset = Some(10), offsetFromLeader = offsetFromLeader, topicId = Some(topicId)) -val responses = replicaManager.describeLogDirs(Set(new TopicPartition(topic, topicPartition))) -assertEquals(mockLogMgr.liveLogDirs.size, responses.size) -responses.foreach { response => - assertEquals(Errors.NONE.code, response.errorCode) - assertTrue(response.totalBytes > 0) - assertTrue(response.usableBytes >= 0) +try { + val responses = replicaManager.describeLogDirs(Set(new TopicPartition(topic, topicPartition))) + assertEquals(mockLogMgr.liveLogDirs.size, responses.size) + responses.foreach { response => +assertEquals(Errors.NONE.code, response.errorCode) +assertTrue(response.totalBytes > 0) +assertTrue(response.usableBytes >= 0) + } +} finally { + // shutdown the replica manager upon test completion + replicaManager.shutdown(checkpointHW = false) Review Comment: I have now added some assertions in existing tests which validate that checkpointHighWatermarks is working correctly. -- 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
[GitHub] [kafka] divijvaidya commented on a diff in pull request #13868: MINOR: Close ReplicaManager correctly in ReplicaManagerTest
divijvaidya commented on code in PR #13868: URL: https://github.com/apache/kafka/pull/13868#discussion_r1235061965 ## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ## @@ -4935,12 +4991,17 @@ class ReplicaManagerTest { topicPartition, leaderEpoch + leaderEpochIncrement, followerBrokerId, leaderBrokerId, countDownLatch, expectTruncation = false, localLogOffset = Some(10), offsetFromLeader = offsetFromLeader, topicId = Some(topicId)) -val responses = replicaManager.describeLogDirs(Set(new TopicPartition(topic, topicPartition))) -assertEquals(mockLogMgr.liveLogDirs.size, responses.size) -responses.foreach { response => - assertEquals(Errors.NONE.code, response.errorCode) - assertTrue(response.totalBytes > 0) - assertTrue(response.usableBytes >= 0) +try { + val responses = replicaManager.describeLogDirs(Set(new TopicPartition(topic, topicPartition))) + assertEquals(mockLogMgr.liveLogDirs.size, responses.size) + responses.foreach { response => +assertEquals(Errors.NONE.code, response.errorCode) +assertTrue(response.totalBytes > 0) +assertTrue(response.usableBytes >= 0) + } +} finally { + // shutdown the replica manager upon test completion + replicaManager.shutdown(checkpointHW = false) Review Comment: I added a new test which verifies that `checkpointHighWatermarks()` is called on shutdown. Also enabled it for a few Hw related tests. -- 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
[GitHub] [kafka] divijvaidya commented on a diff in pull request #13868: MINOR: Close ReplicaManager correctly in ReplicaManagerTest
divijvaidya commented on code in PR #13868: URL: https://github.com/apache/kafka/pull/13868#discussion_r1235057956 ## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ## @@ -343,6 +348,7 @@ class ReplicaManagerTest { assertTrue(appendResult.hasFired) } finally { + // shutdown the replica manager upon test completion Review Comment: That's fair. Removed the comment from everywhere. -- 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
[GitHub] [kafka] divijvaidya commented on a diff in pull request #13868: MINOR: Close ReplicaManager correctly in ReplicaManagerTest
divijvaidya commented on code in PR #13868: URL: https://github.com/apache/kafka/pull/13868#discussion_r1233774289 ## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ## @@ -342,9 +347,7 @@ class ReplicaManagerTest { rm.becomeLeaderOrFollower(1, leaderAndIsrRequest2, (_, _) => ()) assertTrue(appendResult.hasFired) -} finally { - rm.shutdown(checkpointHW = false) -} +} finally rm.shutdown(checkpointHW = false) Review Comment: The test right now is a mix (even without my change). I have made it consistent now. -- 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
[GitHub] [kafka] divijvaidya commented on a diff in pull request #13868: MINOR: Close ReplicaManager correctly in ReplicaManagerTest
divijvaidya commented on code in PR #13868: URL: https://github.com/apache/kafka/pull/13868#discussion_r1233764248 ## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ## @@ -84,7 +84,7 @@ import scala.jdk.CollectionConverters._ class ReplicaManagerTest { val topic = "test-topic" - val topicId = Uuid.randomUuid() + val topicId: Uuid = Uuid.randomUuid() Review Comment: No. I should have called it out. This is a small piggy back change to address the following warning: "Type annotation required for public member" -- 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