> On Nov. 8, 2015, 9:32 a.m., Adam B wrote:
> > src/common/resources.cpp, line 271
> > <https://reviews.apache.org/r/39018/diff/17-18/?file=1115706#file1115706line271>
> >
> >     Red flag: "silently ignored" scares me. Don't you mean that an error in 
> > validate() will yield an empty Resource, which should have been checked 
> > before/after/during this call? Why can't we check 
> > Resources.isEmpty(Resource) here?

Sorry, yea I was tempted by the 
`Resources::Resources(RepeatedPtrField<Resource>)` constructor, which is 
perfect for this conversion but prevents us from catching any errors. I think 
in the long run it would be better to have a factory function for `Resources` 
which returns `Try<Resources`, but for now we can do some redundant error 
checking in `Resources::convertJSON()` which lets us catch errors properly. I 
created a JIRA for the factory function and mentioned it in a TODO. I also 
added to the tests a case with empty resources.


- Greg


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


On Nov. 9, 2015, 5:39 a.m., Greg Mann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39018/
> -----------------------------------------------------------
> 
> (Updated Nov. 9, 2015, 5:39 a.m.)
> 
> 
> Review request for mesos, Adam B, Alexander Rukletsov, Jie Yu, and Michael 
> Park.
> 
> 
> Bugs: MESOS-2467
>     https://issues.apache.org/jira/browse/MESOS-2467
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This includes code changes necessary for JSON parsing of Resources. 
> Documentation changes will be posted soon in another review 
> (https://reviews.apache.org/r/39102/).
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp 6c3a065945eb56dc88df9c977e5ca11d4cbcbf61 
>   include/mesos/v1/resources.hpp fe8925ac851b74d1b37919f00afc7ed816f47ea5 
>   src/common/resources.cpp 601388c35a1bff37c58e753d1870d53b8d0af2d1 
>   src/tests/resources_tests.cpp 6584fc6c39e6ffe9f8085576677dcc669f127697 
>   src/v1/resources.cpp dc868903472f8f3a1ddc56092e3f8f81d953ce39 
> 
> Diff: https://reviews.apache.org/r/39018/diff/
> 
> 
> Testing
> -------
> 
> New code was added to `ResourcesTest.ParsingFromJSON`, and two new tests were 
> added: `ResourcesTest.ParsingFromJSONWithRoles` and 
> `ResourcesTest.ParsingFromJSONError`. These attempt to test common error 
> scenarios that might show up in user-supplied JSON.
> 
> `make check` was used to confirm that all tests pass.
> 
> The original resources parsing format is used throughout many other tests 
> (check `src/tests/sorter_tests.cpp`, for example), so it's clear that the 
> original parsing continues to work correctly.
> 
> 
> Thanks,
> 
> Greg Mann
> 
>

Reply via email to