You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2017/12/05 21:59:07 UTC

[5/8] mesos git commit: Activated AGENT_UPDATE master capability.

Activated AGENT_UPDATE master capability.

Review: https://reviews.apache.org/r/64008/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f4d2c8f5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f4d2c8f5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f4d2c8f5

Branch: refs/heads/master
Commit: f4d2c8f547e42b65dd0040ddbe35157335577f6a
Parents: 2e8c766
Author: Benno Evers <be...@mesosphere.com>
Authored: Tue Dec 5 13:55:52 2017 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Dec 5 13:55:52 2017 -0800

----------------------------------------------------------------------
 src/master/constants.cpp   | 13 ++++++++++++-
 src/tests/master_tests.cpp | 10 +++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f4d2c8f5/src/master/constants.cpp
----------------------------------------------------------------------
diff --git a/src/master/constants.cpp b/src/master/constants.cpp
index 55eecfb..1109b48 100644
--- a/src/master/constants.cpp
+++ b/src/master/constants.cpp
@@ -22,7 +22,18 @@ namespace master {
 
 std::vector<MasterInfo::Capability> MASTER_CAPABILITIES()
 {
-  return {}; // Empty for now.
+  MasterInfo::Capability::Type types[] = {
+    MasterInfo::Capability::AGENT_UPDATE,
+  };
+
+  std::vector<MasterInfo::Capability> result;
+  foreach (MasterInfo::Capability::Type type, types) {
+    MasterInfo::Capability capability;
+    capability.set_type(type);
+    result.push_back(capability);
+  }
+
+  return result;
 }
 
 } // namespace master {

http://git-wip-us.apache.org/repos/asf/mesos/blob/f4d2c8f5/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 08742ec..64ac2d5 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -4515,7 +4515,15 @@ TEST_F(MasterTest, StateEndpoint)
       state.values["unregistered_frameworks"].as<JSON::Array>().values.empty());
 
   ASSERT_TRUE(state.values["capabilities"].is<JSON::Array>());
-  EXPECT_TRUE(state.values["capabilities"].as<JSON::Array>().values.empty());
+  EXPECT_FALSE(state.values["capabilities"].as<JSON::Array>().values.empty());
+
+  JSON::Value masterCapabilities = state.values.at("capabilities");
+
+  // Master should always have the AGENT_UPDATE capability
+  Try<JSON::Value> expectedCapabilities = JSON::parse("[\"AGENT_UPDATE\"]");
+
+  ASSERT_SOME(expectedCapabilities);
+  EXPECT_TRUE(masterCapabilities.contains(expectedCapabilities.get()));
 }