You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by as...@apache.org on 2020/09/11 18:08:24 UTC
[mesos] 05/05: Exposed framework offer constraints via the
GET_FRAMEWORKS call.
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 e00e7a1b578de1161fbb181124cad2a20df5bb95
Author: Andrei Sekretenko <as...@apache.org>
AuthorDate: Mon Sep 7 21:43:27 2020 +0200
Exposed framework offer constraints via the GET_FRAMEWORKS call.
Review: https://reviews.apache.org/r/72842
---
src/master/http.cpp | 4 ++++
src/tests/master/update_framework_tests.cpp | 16 ++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/master/http.cpp b/src/master/http.cpp
index aede6ee..3d8e709 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -1301,6 +1301,10 @@ mesos::master::Response::GetFrameworks::Framework model(
_framework.mutable_offered_resources()->Add()->CopyFrom(resource);
}
+ if (framework.offerConstraints().isSome()) {
+ *_framework.mutable_offer_constraints() = *framework.offerConstraints();
+ }
+
return _framework;
}
diff --git a/src/tests/master/update_framework_tests.cpp b/src/tests/master/update_framework_tests.cpp
index aab94e3..7c83bac 100644
--- a/src/tests/master/update_framework_tests.cpp
+++ b/src/tests/master/update_framework_tests.cpp
@@ -938,8 +938,20 @@ TEST_F(UpdateFrameworkTest, OfferConstraints)
ASSERT_SOME_EQ(JSON::protobuf(updatedConstraints), reportedConstraints);
}
- // TODO(asekretenko): After master starts exposing offer constraints via the
- // V1 API (MESOS-10179), check the constraints in the GET_FRAMEWORKS response.
+ Future<v1::master::Response::GetFrameworks> frameworks =
+ getFrameworks(master->get()->pid);
+ AWAIT_READY(frameworks);
+
+ ASSERT_EQ(frameworks->frameworks_size(), 1);
+ ASSERT_TRUE(frameworks->frameworks(0).has_offer_constraints());
+
+ // TODO(asekretenko): As the semantics of the offer constraints does not
+ // depend on the order of constraints groups and the order of individual
+ // constraints inside groups, we should consider using a `MessageDifferencer`
+ // configured to take this into account.
+ ASSERT_EQ(
+ updatedConstraints.SerializeAsString(),
+ frameworks->frameworks(0).offer_constraints().SerializeAsString());
}