mehbey commented on code in PR #14135:
URL: https://github.com/apache/kafka/pull/14135#discussion_r1289573699


##########
core/src/test/scala/unit/kafka/log/LogValidatorTest.scala:
##########
@@ -1398,6 +1437,73 @@ class LogValidatorTest {
     assertEquals(6, e.recordErrors.size)
   }
 
+  @Test
+  def testRecordWithPastTimestampIsRejected(): Unit = {
+    val timestampBeforeMaxConfig = 24 * 60 * 60 * 1000L //24 hrs
+    val timestampAfterMaxConfig = 1 * 60 * 60 * 1000L //1 hr
+    val now = System.currentTimeMillis()
+    val fiveMinutesBeforeThreshold = now - timestampBeforeMaxConfig - (5 * 60 
* 1000L)
+    val records = createRecords(magicValue = RecordBatch.MAGIC_VALUE_V2, 
timestamp = fiveMinutesBeforeThreshold,
+      codec = CompressionType.GZIP)
+    val e = assertThrows(classOf[RecordValidationException],
+      () => new LogValidator(
+        records,
+        topicPartition,
+        time,
+        CompressionType.GZIP,
+        CompressionType.GZIP,
+        false,
+        RecordBatch.MAGIC_VALUE_V1,

Review Comment:
   no reason, just a bad copy paste from other tests :). Updated, thank you.



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

Reply via email to