This is an automated email from the ASF dual-hosted git repository. asekretenko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 242f49ee95e0bcac68d67e0d07f0ce5f3a133e87 Author: Andrei Sekretenko <[email protected]> AuthorDate: Tue Sep 22 14:55:43 2020 +0200 Added a test for creating a filter from default `OfferConstraints`. Review: https://reviews.apache.org/r/72899 --- src/tests/master/offer_constraints_filter_tests.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/tests/master/offer_constraints_filter_tests.cpp b/src/tests/master/offer_constraints_filter_tests.cpp index f80d56c..64b6f12 100644 --- a/src/tests/master/offer_constraints_filter_tests.cpp +++ b/src/tests/master/offer_constraints_filter_tests.cpp @@ -581,3 +581,16 @@ TEST(OfferConstraintsFilter, TwoRoles) EXPECT_TRUE( filter->isAgentExcluded("roleB", slaveInfoWithAttributes("foo:123"))); } + + +// Tests that using default-constructed `OfferConstraints` to construct +// a filter results in a no-op filter that does not exclude any agents +// (and not, for example, in an error). +TEST(OfferConstraintsFilter, DefaultOfferConstraints) +{ + const Try<OfferConstraintsFilter> filter = createFilter(OfferConstraints{}); + + ASSERT_SOME(filter); + + EXPECT_FALSE(filter->isAgentExcluded("role", SlaveInfo{})); +}
