> On June 18, 2016, 5 p.m., haosdent huang wrote: > > src/tests/api_tests.cpp, lines 459-475 > > <https://reviews.apache.org/r/48094/diff/6/?file=1423446#file1423446line459> > > > > I suggest change this to > > ``` > > v1::Resources expectedResources = > > v1::Resources::parse(slaveFlags.resources).get(); > > > > bool matched = false; > > foreach (const xxx& role, v1Response->get_roles().roles()) { > > if (role.name() == "role2") { > > ASSERT_EQ(2.5, role.weight()); > > ASSERT_EQ(expectedResources, roles.resources()); > > matched = true; > > } > > } > > ASSERT_TRUE(matched); > > ```
v1Response->get_roles().roles() returns a protobuf repeated pointer field. Would it not be a little bit complicated to use foreach here? Though use of bool matched is good.. I can make that change.. But is foreach really neccessary here?? - Abhishek ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/48094/#review138412 ----------------------------------------------------------- On June 18, 2016, 4:21 p.m., Abhishek Dasgupta wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/48094/ > ----------------------------------------------------------- > > (Updated June 18, 2016, 4:21 p.m.) > > > Review request for mesos, Anand Mazumdar and Vinod Kone. > > > Bugs: MESOS-5494 > https://issues.apache.org/jira/browse/MESOS-5494 > > > Repository: mesos > > > Description > ------- > > Implemented GET_ROLES Call in v1 master API. > > > Diffs > ----- > > include/mesos/master/master.proto fa92240 > include/mesos/mesos.proto e4c5bd3 > include/mesos/v1/master/master.proto 59e978f > include/mesos/v1/mesos.proto 9be22f0 > src/master/http.cpp a6beb17 > src/master/master.hpp 618d928 > src/tests/api_tests.cpp afa5ffa > > Diff: https://reviews.apache.org/r/48094/diff/ > > > Testing > ------- > > On Ubuntu 16.04: > > sudo GTEST_FILTER="*MasterAPITest.*" make -j2 check > > > Thanks, > > Abhishek Dasgupta > >
