You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2017/03/09 21:59:21 UTC
[1/2] mesos git commit: Added `initializer_list` constructors for
`JSON::(Object|Array)`.
Repository: mesos
Updated Branches:
refs/heads/master 4f50c575f -> 339d9f837
Added `initializer_list` constructors for `JSON::(Object|Array)`.
This improves test cleanliness, as it allows inline construction of
expected values with which to perform tests.
Refer to https://reviews.apache.org/r/57336 to see how this is used.
Review: https://reviews.apache.org/r/57354
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1bab64fc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1bab64fc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1bab64fc
Branch: refs/heads/master
Commit: 1bab64fce462177651f7fc25a882522a9c3b681c
Parents: 4f50c57
Author: Michael Park <mp...@apache.org>
Authored: Mon Mar 6 17:12:30 2017 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Thu Mar 9 13:45:17 2017 -0800
----------------------------------------------------------------------
3rdparty/stout/include/stout/json.hpp | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1bab64fc/3rdparty/stout/include/stout/json.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/json.hpp b/3rdparty/stout/include/stout/json.hpp
index b0fd667..be73340 100644
--- a/3rdparty/stout/include/stout/json.hpp
+++ b/3rdparty/stout/include/stout/json.hpp
@@ -152,6 +152,11 @@ private:
struct Object
{
+ Object() = default;
+
+ Object(std::initializer_list<std::pair<const std::string, Value>> values_)
+ : values(values_) {}
+
// Returns the JSON value (specified by the type) given a "path"
// into the structure, for example:
//
@@ -187,6 +192,9 @@ struct Object
struct Array
{
+ Array() = default;
+ Array(std::initializer_list<Value> values_) : values(values_) {}
+
std::vector<Value> values;
};
[2/2] mesos git commit: Updated `MultiRoleSchedulerUpgrade` to test
framework updates.
Posted by mp...@apache.org.
Updated `MultiRoleSchedulerUpgrade` to test framework updates.
Review: https://reviews.apache.org/r/57336
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/339d9f83
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/339d9f83
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/339d9f83
Branch: refs/heads/master
Commit: 339d9f837e365e5b7f11d3cc3863314680248852
Parents: 1bab64f
Author: Michael Park <mp...@apache.org>
Authored: Mon Mar 6 05:11:16 2017 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Thu Mar 9 13:45:24 2017 -0800
----------------------------------------------------------------------
src/tests/upgrade_tests.cpp | 43 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/339d9f83/src/tests/upgrade_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/upgrade_tests.cpp b/src/tests/upgrade_tests.cpp
index 0b51a2c..baf16f8 100644
--- a/src/tests/upgrade_tests.cpp
+++ b/src/tests/upgrade_tests.cpp
@@ -16,6 +16,7 @@
#include <unistd.h>
+#include <initializer_list>
#include <memory>
#include <string>
#include <vector>
@@ -59,10 +60,12 @@ using process::Message;
using process::Owned;
using process::PID;
using process::Promise;
+using process::UPID;
using process::http::OK;
using process::http::Response;
+using std::initializer_list;
using std::vector;
using testing::_;
@@ -462,6 +465,9 @@ TEST_F(UpgradeTest, MultiRoleSchedulerUpgrade)
EXPECT_CALL(sched2, registered(&driver2, frameworkId.get(), _))
.WillOnce(FutureSatisfy(®istered2));
+ Future<UpdateFrameworkMessage> updateFrameworkMessage =
+ FUTURE_PROTOBUF(UpdateFrameworkMessage(), _, _);
+
// Scheduler1 should get an error due to failover.
EXPECT_CALL(sched1, error(&driver1, "Framework failed over"));
@@ -469,6 +475,43 @@ TEST_F(UpgradeTest, MultiRoleSchedulerUpgrade)
AWAIT_READY(registered2);
+ // Wait for the agent to get the updated framework info.
+ AWAIT_READY(updateFrameworkMessage);
+
+ // Check that the framework has been updated to use `roles` rather than `role`
+ // in both the master and the agent.
+ initializer_list<UPID> pids = { master.get()->pid, agent.get()->pid };
+ foreach (const UPID& pid, pids) {
+ Future<Response> response = process::http::get(
+ pid, "state", None(), createBasicAuthHeaders(DEFAULT_CREDENTIAL));
+
+ AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
+ AWAIT_EXPECT_RESPONSE_HEADER_EQ(APPLICATION_JSON, "Content-Type", response);
+
+ Try<JSON::Object> parse = JSON::parse<JSON::Object>(response->body);
+ ASSERT_SOME(parse);
+
+ JSON::Value result = parse.get();
+
+ JSON::Object unexpected = {
+ {
+ "frameworks",
+ JSON::Array { JSON::Object { { "role", "foo" } } }
+ }
+ };
+
+ EXPECT_TRUE(!result.contains(unexpected));
+
+ JSON::Object expected = {
+ {
+ "frameworks",
+ JSON::Array { JSON::Object { { "roles", JSON::Array { "foo" } } } }
+ }
+ };
+
+ EXPECT_TRUE(result.contains(expected));
+ }
+
driver1.stop();
driver1.join();