----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/52642/#review154824 -----------------------------------------------------------
Thanks Gaston! The fix looks good, but some of the tests don't seem to match their comments? Also, I commented on the unreserve validation (see below) but we can deal with that separately. After the test cleanups this should be good to go. src/master/validation.cpp (lines 1454 - 1456) <https://reviews.apache.org/r/52642/#comment224539> Looks like you forgot to close the quote on the last line. Can you put quotes on the same line? It's less likely we forget to close this way: ``` return Error( "A reserve operation was attempted for role" " '" + role.get() + "', but there is a reserved resource" " in the request with role '" + resource.role() + "'"); ``` src/tests/master_validation_tests.cpp (lines 207 - 218) <https://reviews.apache.org/r/52642/#comment224540> Hm.. it's too bad this test wasn't doing what its comment said, otherwise we'd have found this earlier :) Just a note, I find the following a bit clearer for the validation assertions: ``` Option<Error> error = operation::validate(...); EXPECT_SOME(error); ``` But since all of the tests don't use this pattern right now, it would be better to do a sweep. src/tests/master_validation_tests.cpp (lines 207 - 208) <https://reviews.apache.org/r/52642/#comment224548> How about just saying "reservation role" and "framework role" to disambiguate these, here and in all of the comments below. src/tests/master_validation_tests.cpp (lines 221 - 222) <https://reviews.apache.org/r/52642/#comment224541> Hm.. this comment does not match the test logic? Here your framework has `"role"` role, not `"*"` role. src/tests/master_validation_tests.cpp (lines 237 - 238) <https://reviews.apache.org/r/52642/#comment224546> It looks like if you swapped this test comment with the comment immediately above, then the comments would become accurate? src/tests/master_validation_tests.cpp (line 343) <https://reviews.apache.org/r/52642/#comment224551> Shouldn't we be checking that a framework can't remove a reservation for a role that doesn't match the framework's role? This technically shouldn't happen because we wouldn't have offered the resources to the framework, but this unfortunately requires some "non-local reasoning" to figure out why we don't have to check it. src/tests/master_validation_tests.cpp (lines 346 - 348) <https://reviews.apache.org/r/52642/#comment224549> Have you gone through these tests? They also seem confusing. For example, this one says "framework with a principal" but it doesn't provide principal to the validate call. I would expect to see reservation principal vs framework principal, no? - Benjamin Mahler On Oct. 24, 2016, 3:25 p.m., Gastón Kleiman wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/52642/ > ----------------------------------------------------------- > > (Updated Oct. 24, 2016, 3:25 p.m.) > > > Review request for mesos, Alexander Rukletsov and Michael Park. > > > Bugs: MESOS-6142 > https://issues.apache.org/jira/browse/MESOS-6142 > > > Repository: mesos > > > Description > ------- > > Don't allow a reservation if the framework role doesn't match the role > of all the resources. > > > Diffs > ----- > > src/master/http.cpp 05d29906a73fb049c085abca05b75ec68c259d26 > src/master/master.cpp 23ddb995b4ad0fcdb589974308a2e81ececdad31 > src/master/validation.hpp 035f721c610ae566c89a1cf0e65ff0df11679f15 > src/master/validation.cpp f690a9eacd278b51a52f5588dbeea377df074435 > src/tests/master_validation_tests.cpp > a5d8610bd61822cdf55cbc8d7056e5cf8fecfa54 > src/tests/reservation_tests.cpp 6c28ab4557f342134efce0ad7cb174a5adb4dc10 > > Diff: https://reviews.apache.org/r/52642/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Gastón Kleiman > >
