> On Jan. 11, 2016, 2:13 a.m., Adam B wrote:
> > src/tests/hierarchical_allocator_tests.cpp, line 2095
> > <https://reviews.apache.org/r/41672/diff/6/?file=1181569#file1181569line2095>
> >
> >     When did we start initializing string constants with braces instead of 
> > '='s? What's the benefit?
> 
> Yongqiao Wang wrote:
>     I refer the quota-related code to use {""} (such as 
> master_quota_tests.cpp, and quota tests in this file), actually, I am not 
> sure the difference between them, but in C++ standard library, it uses '=', 
> so I have updated my code to use '=' now.

Thank you. I'm not sure I agree with its use in the quota code either, but 
that's a separate discussion. Moral of the story: don't just copy 1 example, 
since it could be a flawed example. Examine 2-3 if possible to see where 
they're the same and where they differ, then go with the most sensible/common 
version.


> On Jan. 11, 2016, 2:13 a.m., Adam B wrote:
> > src/tests/hierarchical_allocator_tests.cpp, lines 2218-2219
> > <https://reviews.apache.org/r/41672/diff/6/?file=1181569#file1181569line2218>
> >
> >     Why hardcode 3? I'd think you could just run a while loop and actually 
> > assert the size that you think the allocations hashmap will be. (And what 
> > key will be in each entry.)
> 
> Yongqiao Wang wrote:
>     allocations is a process::Queue<Allocation>, and I can not get its size 
> due to there is no interface can do this. Could you give me a detailed 
> description for your suggestions? Thanks.
>     
>     In addition, I can make sure there are 3 allocations because in my test 
> case, there are 4 agents and 3 frameworks, and their weights are 3:1:2, so 
> according to the fair share, each framework can get one allocation at least.

Fair point, and even if you did a `while(allocations.get() != something)`, 
you'd actually be getting a future that your `while` condition would have to 
AWAIT before it could evaluate. Messy.
Rather, you're iterating 3 times and AWAITing each time, therefore asserting 
that there are at least 3 allocations. To prove that there are exactly 3 (or 2 
in the other cases), can you `AWAIT_FAILED(allocations.get())` after your 
loops? I'm not sure if the `Clock` would work for/against you there, especially 
since you're recovering resources inside the loop instead of after it.
Looks like `process::queue::get()` returns a READY future immediately if the 
offer queue isn't empty, so maybe you can get away with 
`ASSERT_FALSE(allocation.isReady());` after the loop.


- Adam


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


On Jan. 12, 2016, 6:56 a.m., Yongqiao Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41672/
> -----------------------------------------------------------
> 
> (Updated Jan. 12, 2016, 6:56 a.m.)
> 
> 
> Review request for mesos, Adam B, Neil Conway, and Qian Zhang.
> 
> 
> Bugs: MESOS-4200
>     https://issues.apache.org/jira/browse/MESOS-4200
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Test case(s) for weights + allocation behavior
> 
> 
> Diffs
> -----
> 
>   src/tests/hierarchical_allocator_tests.cpp 
> e044f832c2c16e53e663c6ced5452649bb0dcb59 
> 
> Diff: https://reviews.apache.org/r/41672/diff/
> 
> 
> Testing
> -------
> 
> Make check done:
> Yongs-MacBook-Pro:build yqwyq$ ./src/mesos-tests 
> --gtest_filter=HierarchicalAllocatorTest.UpdateWeight
> Source directory: /Users/yqwyq/Desktop/mesos
> Build directory: /Users/yqwyq/Desktop/mesos/build
> [==========] Running 1 test from 1 test case.
> [----------] Global test environment set-up.
> [----------] 1 test from HierarchicalAllocatorTest
> [ RUN      ] HierarchicalAllocatorTest.UpdateWeight
> [       OK ] HierarchicalAllocatorTest.UpdateWeight (87 ms)
> [----------] 1 test from HierarchicalAllocatorTest (87 ms total)
> 
> [----------] Global test environment tear-down
> [==========] 1 test from 1 test case ran. (176 ms total)
> [  PASSED  ] 1 test.
> 
> 
> Thanks,
> 
> Yongqiao Wang
> 
>

Reply via email to