You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2018/03/23 07:57:05 UTC
[10/13] mesos git commit: Added v1 versions of some test
helpers/matchers.
Added v1 versions of some test helpers/matchers.
Review: https://reviews.apache.org/r/66058/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6c4b2d4e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6c4b2d4e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6c4b2d4e
Branch: refs/heads/master
Commit: 6c4b2d4e9545641aa3751a5dea5f745b1e292cd8
Parents: 436340c
Author: Gaston Kleiman <ga...@mesosphere.io>
Authored: Thu Mar 22 21:52:52 2018 -0700
Committer: Greg Mann <gr...@gmail.com>
Committed: Thu Mar 22 22:02:16 2018 -0700
----------------------------------------------------------------------
src/tests/mesos.hpp | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6c4b2d4e/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 500ef43..b5731e4 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -2554,6 +2554,42 @@ using TestMesos = tests::scheduler::TestMesos<
mesos::v1::scheduler::Event>;
+// This matcher is used to match an offer event that contains a vector of offers
+// having any resource that passes the filter.
+MATCHER_P(OffersHaveAnyResource, filter, "")
+{
+ foreach (const Offer& offer, arg.offers()) {
+ foreach (const Resource& resource, offer.resources()) {
+ if (filter(resource)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+// Like LaunchTasks, but decline the entire offer and don't launch any tasks.
+ACTION(DeclineOffers)
+{
+ Call call;
+ call.set_type(Call::DECLINE);
+
+ Call::Decline* decline = call.mutable_decline();
+
+ foreach (const Offer& offer, arg1.offers()) {
+ decline->add_offer_ids()->CopyFrom(offer.id());
+
+ if (!call.has_framework_id()) {
+ call.mutable_framework_id()->CopyFrom(offer.framework_id());
+ }
+ }
+
+ arg0->send(call);
+}
+
+
ACTION_P(SendSubscribe, frameworkInfo)
{
Call call;