You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by dm...@apache.org on 2015/02/25 21:45:38 UTC
mesos git commit: Move test utility from mesos.hpp to utils.hpp
Repository: mesos
Updated Branches:
refs/heads/master 68f54aa4e -> 6568b7d8f
Move test utility from mesos.hpp to utils.hpp
Review: https://reviews.apache.org/r/31426
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6568b7d8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6568b7d8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6568b7d8
Branch: refs/heads/master
Commit: 6568b7d8fea1f9832d0fea353b525ba772e5bb31
Parents: 68f54aa
Author: Dominic Hamon <dm...@twitter.com>
Authored: Wed Feb 25 12:00:10 2015 -0800
Committer: Dominic Hamon <dm...@twitter.com>
Committed: Wed Feb 25 12:45:06 2015 -0800
----------------------------------------------------------------------
src/tests/master_authorization_tests.cpp | 1 +
src/tests/master_slave_reconciliation_tests.cpp | 1 +
src/tests/master_tests.cpp | 1 +
src/tests/mesos.cpp | 19 ---------------
src/tests/mesos.hpp | 4 ----
src/tests/rate_limiting_tests.cpp | 1 +
src/tests/utils.cpp | 25 ++++++++++++++++++++
src/tests/utils.hpp | 6 +++++
8 files changed, 35 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6568b7d8/src/tests/master_authorization_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_authorization_tests.cpp b/src/tests/master_authorization_tests.cpp
index 55dae40..ff706ed 100644
--- a/src/tests/master_authorization_tests.cpp
+++ b/src/tests/master_authorization_tests.cpp
@@ -40,6 +40,7 @@
#include "slave/slave.hpp"
#include "tests/mesos.hpp"
+#include "tests/utils.hpp"
using mesos::internal::master::Master;
http://git-wip-us.apache.org/repos/asf/mesos/blob/6568b7d8/src/tests/master_slave_reconciliation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_slave_reconciliation_tests.cpp b/src/tests/master_slave_reconciliation_tests.cpp
index 54cae62..e60f601 100644
--- a/src/tests/master_slave_reconciliation_tests.cpp
+++ b/src/tests/master_slave_reconciliation_tests.cpp
@@ -40,6 +40,7 @@
#include "tests/containerizer.hpp"
#include "tests/mesos.hpp"
+#include "tests/utils.hpp"
using namespace mesos::internal::protobuf;
http://git-wip-us.apache.org/repos/asf/mesos/blob/6568b7d8/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 24cff38..5692f07 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -57,6 +57,7 @@
#include "tests/containerizer.hpp"
#include "tests/mesos.hpp"
+#include "tests/utils.hpp"
using mesos::internal::master::Master;
http://git-wip-us.apache.org/repos/asf/mesos/blob/6568b7d8/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index df051d9..851aaa2 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -346,25 +346,6 @@ void MesosTest::ShutdownSlaves()
}
-JSON::Object MesosTest::Metrics() const
-{
- process::UPID upid("metrics", process::address());
-
- process::Future<process::http::Response> response =
- process::http::get(upid, "snapshot");
- AWAIT_EXPECT_RESPONSE_STATUS_EQ(process::http::OK().status, response);
-
- EXPECT_SOME_EQ(
- "application/json",
- response.get().headers.get("Content-Type"));
-
- Try<JSON::Object> parse = JSON::parse<JSON::Object>(response.get().body);
- CHECK_SOME(parse);
-
- return parse.get();
-}
-
-
MockSlave::MockSlave(const slave::Flags& flags,
MasterDetector* detector,
slave::Containerizer* containerizer)
http://git-wip-us.apache.org/repos/asf/mesos/blob/6568b7d8/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 14f5d39..abf45c7 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -180,10 +180,6 @@ protected:
// Stop all slaves.
virtual void ShutdownSlaves();
- // Get the metrics snapshot.
- // TODO(vinod): Move this into a libprocess "tests/utils.hpp".
- JSON::Object Metrics() const;
-
Cluster cluster;
// Containerizer(s) created during test that we need to cleanup.
http://git-wip-us.apache.org/repos/asf/mesos/blob/6568b7d8/src/tests/rate_limiting_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/rate_limiting_tests.cpp b/src/tests/rate_limiting_tests.cpp
index c65001a..d5c00b8 100644
--- a/src/tests/rate_limiting_tests.cpp
+++ b/src/tests/rate_limiting_tests.cpp
@@ -31,6 +31,7 @@
#include "master/allocator/allocator.hpp"
#include "tests/mesos.hpp"
+#include "tests/utils.hpp"
using namespace mesos::internal::master;
http://git-wip-us.apache.org/repos/asf/mesos/blob/6568b7d8/src/tests/utils.cpp
----------------------------------------------------------------------
diff --git a/src/tests/utils.cpp b/src/tests/utils.cpp
index f4f90b9..498c9aa 100644
--- a/src/tests/utils.cpp
+++ b/src/tests/utils.cpp
@@ -22,6 +22,12 @@
#include <gtest/gtest.h>
+#include <process/future.hpp>
+#include <process/gtest.hpp>
+#include <process/http.hpp>
+#include <process/pid.hpp>
+#include <process/process.hpp>
+
#include <stout/gtest.hpp>
#include <stout/os.hpp>
#include <stout/path.hpp>
@@ -70,6 +76,25 @@ void TemporaryDirectoryTest::TearDown()
}
}
+
+JSON::Object Metrics()
+{
+ process::UPID upid("metrics", process::address());
+
+ process::Future<process::http::Response> response =
+ process::http::get(upid, "snapshot");
+ AWAIT_EXPECT_RESPONSE_STATUS_EQ(process::http::OK().status, response);
+
+ EXPECT_SOME_EQ(
+ "application/json",
+ response.get().headers.get("Content-Type"));
+
+ Try<JSON::Object> parse = JSON::parse<JSON::Object>(response.get().body);
+ CHECK_SOME(parse);
+
+ return parse.get();
+}
+
} // namespace tests {
} // namespace internal {
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/6568b7d8/src/tests/utils.hpp
----------------------------------------------------------------------
diff --git a/src/tests/utils.hpp b/src/tests/utils.hpp
index 5c86fd4..f2eed2e 100644
--- a/src/tests/utils.hpp
+++ b/src/tests/utils.hpp
@@ -23,6 +23,7 @@
#include <string>
+#include <stout/json.hpp>
#include <stout/option.hpp>
namespace mesos {
@@ -42,6 +43,11 @@ private:
Option<std::string> sandbox;
};
+
+// Get the metrics snapshot.
+// TODO(vinod): Move this into a libprocess utility header.
+JSON::Object Metrics();
+
} // namespace tests {
} // namespace internal {
} // namespace mesos {