gemmellr commented on pull request #3812:
URL: https://github.com/apache/activemq-artemis/pull/3812#issuecomment-967070852


   > > Can you check on testSimpleTickforMinDiskFree(). it's always failing.
   > 
   > That test is just a following copy of testSimpleTickforMaxDiskUsage() 
(initally testSimpleTick())
   > 
   > The test fails because I haven't fully understood the logic of 
testSimpleTick. Can you pls explain to me the logic of this code:
   > 
   > ```
   >       storeMonitor.tick();
   > 
   >       Assert.assertEquals(0, overMaxUsage.get());
   >       Assert.assertEquals(1, tick.get());
   >       Assert.assertEquals(1, underMaxUsage.get());
   > 
   >       storeMonitor.setMaxUsage(0);
   > 
   >       storeMonitor.tick();
   > 
   >       Assert.assertEquals(1, overMaxUsage.get());
   >       Assert.assertEquals(2, tick.get());
   >       Assert.assertEquals(1, underMaxUsage.get());
   > ```
   
   The existing test creates a storeMonitor and passes a maxUsage value of 
0.999, such that its checking a limit of 99.9% usage, i.e something it assumes 
it should hopefully be under. After the first tick shown there, it checks the 
'over' callback was not called and that the 'under' callback was. It then 
alters the maxUsage value to be 0, meaning 0% usage, which it assumes the file 
it wrote originally plus any other existing usage, will hopefully push it usage 
over the new low limit. It then calls tick again and ensures the 'over' 
callback fired but not the 'under' callback. (Its assumptions are a little 
brittle, but will typically work).
   
   Your new test would do something similar but use extreme values to compare 
against the actual free space limit, say 0/1 byte and Long.MAX_VALUE, to try 
and ensure the actual value went over/under it.


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