mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Mahler <bmah...@apache.org>
Subject Re: Review Request 69600: Added tests for class `Quantity` and `ResourceQuantities`.
Date Thu, 03 Jan 2019 17:48:14 GMT

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



Stale summary?

Partial review since it looks like some of what's being tested will change based on updates
to the first patch.


src/Makefile.am
Lines 2541 (patched)
<https://reviews.apache.org/r/69600/#comment297033>

    Seems we should name this file and the header `resource_quantities.hpp` and `resource_quantities_tests.cpp`?



src/tests/quantities_tests.cpp
Lines 27 (patched)
<https://reviews.apache.org/r/69600/#comment297035>

    Seems odd to have a namespace for this, just having mesos::internal::ResourceQuantities
live one level beneath mesos::Resources seems more appropriate?
    
    Also, I think we try to avoid `using` entire namespaces going forward.



src/tests/quantities_tests.cpp
Lines 158 (patched)
<https://reviews.apache.org/r/69600/#comment297036>

    Hm.. holding a vector iterator while insertions might happen seems error prone and we'd
like to avoid tests crashing when they fail.
    
    Is there a safer way to check what you want to check? E.g. just call `begin()` or `get("cpus")`
each time.



src/tests/quantities_tests.cpp
Lines 162-163 (patched)
<https://reviews.apache.org/r/69600/#comment297037>

    Maybe this can be more readable with a scalar producing lambda?
    
    ```
    auto scalar = [](double d) { ... };
    
    quantities.subtract("cpus", scalar(4));
    ```
    
    Also, is it possible to check the storage more succinctly and readably?
    
    ```
      EXPECT_EQ({{"cpus", 6.0}}, toVector(quantities));
    ```
    
    toVector would produce a `vector<pair<string,Value::Scalar>>` via the iterators.


- Benjamin Mahler


On Dec. 31, 2018, 5:52 a.m., Meng Zhu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/69600/
> -----------------------------------------------------------
> 
> (Updated Dec. 31, 2018, 5:52 a.m.)
> 
> 
> Review request for mesos and Benjamin Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added parsing and some arithmetic tests for class `Quantity`
> and `ResourceQuantities`.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am 7a4904a3d67479267087fd2313a263d8218843fa 
>   src/tests/CMakeLists.txt c588183e9d2b1cc733fdf3df70f37d47a5fdd7c0 
>   src/tests/quantities_tests.cpp PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/69600/diff/2/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Meng Zhu
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message