> On July 5, 2016, 3:08 p.m., Alexander Rukletsov wrote:
> > src/tests/hierarchical_allocator_tests.cpp, line 3100
> > <https://reviews.apache.org/r/49612/diff/2/?file=1436764#file1436764line3100>
> >
> >     I would keep these 3 instances in this test. It's not immediately clear 
> > that `AWAIT` happens in `handleAllocationsAndRecoverResources()`.
> 
> Neil Conway wrote:
>     I don't agree with keeping `Clock::settle` in this case. For one thing, 
> it implies the wrong thing: i.e., keeping `Clock::settle` implies that 
> `handleAllocationsAndRecoverResources()` does not do sufficient 
> synchronization on its own, which is incorrect.
>     
>     Second, `Clock::settle` is a kludge; it should only be used when there is 
> _no other way_ to achieve the synchronization required by the test. So I'd 
> prefer to discourage its use whenever possible.

In general, `Clock::settle` is not a kludge: it allows to make sure a certain 
event is processed before another event is scheduled.

It is not the case here, though. We usually write tests in a way that people 
can easily follow main steps without looking into functions (hence a lot od 
copy paste code instead of fixture methods). 
`handleAllocationsAndRecoverResources()` already breaks this convention by 
modifying the caller's context; removing `Clock::settle` makes things even 
worse IMO.


- Alexander


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/49612/#review140790
-----------------------------------------------------------


On July 5, 2016, 8:51 a.m., Neil Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49612/
> -----------------------------------------------------------
> 
> (Updated July 5, 2016, 8:51 a.m.)
> 
> 
> Review request for mesos and Alexander Rukletsov.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> If a test case calls `Clock::settle` and then immediately waits for a
> future to be completed, settling the clock is usually unnecessary.
> 
> 
> Diffs
> -----
> 
>   src/tests/hierarchical_allocator_tests.cpp 
> 0498cd5e54b0e4b87a767585a77699653aa52179 
> 
> Diff: https://reviews.apache.org/r/49612/diff/
> 
> 
> Testing
> -------
> 
> `mesos-tests --gtest_filter=HierarchicalAllocatorTest.* --gtest_repeat=500 
> --gtest_break_on_failure`
> 
> 
> Thanks,
> 
> Neil Conway
> 
>

Reply via email to