kamalcph commented on code in PR #21213:
URL: https://github.com/apache/kafka/pull/21213#discussion_r2664264123


##########
storage/src/test/java/org/apache/kafka/server/log/remote/storage/RemoteLogManagerTest.java:
##########
@@ -2177,6 +2177,80 @@ public void testRemoteSizeData() {
         }
     }
 
+    @Test
+    public void testBuildRetentionSizeData() throws RemoteStorageException {
+        long retentionSize = 1000L;
+        long onlyLocalLogSegmentsSize = 500L;
+        long logEndOffset = 100L;
+        NavigableMap<Integer, Long> epochEntries = new TreeMap<>();
+        epochEntries.put(0, 0L);
+        long fullCopyFinishedSegmentsSizeInBytes = 1600L;
+        RemoteLogManager.RLMExpirationTask expirationTask = 
remoteLogManager.new RLMExpirationTask(leaderTopicIdPartition);
+        assertFalse(expirationTask.isAllSegmentsValid());
+
+        // 1. retentionSize < 0
+        Optional<RemoteLogManager.RetentionSizeData> result = expirationTask
+                .buildRetentionSizeData(-1L, onlyLocalLogSegmentsSize, 
logEndOffset, epochEntries, fullCopyFinishedSegmentsSizeInBytes);
+        assertFalse(result.isPresent());
+        assertFalse(expirationTask.isAllSegmentsValid());
+
+        // 2. When (onlyLocalLogSegmentsSize + 
fullCopyFinishedSegmentsSizeInBytes) <= configure-retention-size
+        result = expirationTask
+                .buildRetentionSizeData(-1L, onlyLocalLogSegmentsSize, 
logEndOffset, epochEntries, 500L);

Review Comment:
   Fixed the test case.



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