zhuzhurk commented on a change in pull request #10398: [FLINK-14936][runtime] 
Introduce MemoryManager#computeMemorySize to calculate managed memory size from 
a fraction
URL: https://github.com/apache/flink/pull/10398#discussion_r353155667
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/memory/MemoryManagerTest.java
 ##########
 @@ -298,6 +299,39 @@ public void testMemoryAllocationAndReservation() throws 
MemoryAllocationExceptio
                memoryManager.releaseAllMemory(owner2, type);
        }
 
+       @Test
+       public void testComputeMemorySize() {
+               double fraction = 0.6;
+               assertEquals((long) (memoryManager.getMemorySize() * fraction), 
memoryManager.computeMemorySize(fraction));
+
+               fraction = 1.0;
+               assertEquals((long) (memoryManager.getMemorySize() * fraction), 
memoryManager.computeMemorySize(fraction));
+       }
+
+       @Test
+       public void testComputeMemorySizeInvalidFraction() {
+               try {
+                       memoryManager.computeMemorySize(0.0);
 
 Review comment:
   Sure.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to