chia7712 commented on code in PR #24065:
URL: https://github.com/apache/kafka/pull/24065#discussion_r4434877800


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -1141,6 +1141,27 @@ class PlaintextAdminIntegrationTest extends 
BaseAdminIntegrationTest {
     val cause = assertThrows(classOf[ExecutionException],
       () => client.deleteRecords(util.Map.of(topicPartition, 
RecordsToDelete.beforeOffset(20L))).lowWatermarks.get(topicPartition).get).getCause
     assertEquals(classOf[OffsetOutOfRangeException], cause.getClass)
+
+    // OffsetOutOfRangeException if offset is negative and not -1
+    val negativeOffsetCause = assertThrows(classOf[ExecutionException],
+      () => client.deleteRecords(util.Map.of(topicPartition, 
RecordsToDelete.beforeOffset(-2L))).lowWatermarks.get(topicPartition).get).getCause
+    assertEquals(classOf[OffsetOutOfRangeException], 
negativeOffsetCause.getClass)
+
+    // The failed requests did not delete any records
+    assertEquals(5L, client.listOffsets(util.Map.of(topicPartition, 
OffsetSpec.earliest()))
+      .partitionResult(topicPartition).get.offset)
+  }
+
+  @Test
+  def testDeleteRecordsToHighWatermark(): Unit = {

Review Comment:
   We should put the new test cases in the clients-integration-tests module as 
much as possible. Would you mind creating a new file `DeleteRecordsTest` to 
cover those scenarios?



-- 
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]

Reply via email to