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 2014/04/24 20:14:29 UTC
[2/2] git commit: Renamed and moved MasterZooKeeperTest fixture.
Renamed and moved MasterZooKeeperTest fixture.
Review: https://reviews.apache.org/r/20584
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/025e4695
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/025e4695
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/025e4695
Branch: refs/heads/master
Commit: 025e4695f57c6accb8581a9161290d9ae7065735
Parents: 397dc81
Author: Vinod Kone <vi...@twitter.com>
Authored: Tue Apr 22 15:55:51 2014 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Thu Apr 24 11:14:19 2014 -0700
----------------------------------------------------------------------
src/tests/allocator_zookeeper_tests.cpp | 39 +-------------------------
src/tests/master_tests.cpp | 42 +---------------------------
src/tests/mesos.cpp | 5 ++++
src/tests/mesos.hpp | 41 +++++++++++++++++++++++++++
4 files changed, 48 insertions(+), 79 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/025e4695/src/tests/allocator_zookeeper_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/allocator_zookeeper_tests.cpp b/src/tests/allocator_zookeeper_tests.cpp
index 9ad0fa7..1f15cf5 100644
--- a/src/tests/allocator_zookeeper_tests.cpp
+++ b/src/tests/allocator_zookeeper_tests.cpp
@@ -55,44 +55,7 @@ using testing::DoDefault;
template <typename T = AllocatorProcess>
-class AllocatorZooKeeperTest : public MesosTest
-{
-public:
- static void SetUpTestCase()
- {
- // Make sure the JVM is created.
- ZooKeeperTest::SetUpTestCase();
-
- // Launch the ZooKeeper test server.
- server = new ZooKeeperTestServer();
- server->startNetwork();
-
- Try<zookeeper::URL> parse = zookeeper::URL::parse(
- "zk://" + server->connectString() + "/znode");
- ASSERT_SOME(parse);
-
- url = parse.get();
- }
-
- static void TearDownTestCase()
- {
- delete server;
- server = NULL;
- }
-
-protected:
- AllocatorZooKeeperTest() : MesosTest(url) {}
-
- static ZooKeeperTestServer* server;
- static Option<zookeeper::URL> url;
-};
-
-
-template <typename T>
-ZooKeeperTestServer* AllocatorZooKeeperTest<T>::server = NULL;
-
-template <typename T>
-Option<zookeeper::URL> AllocatorZooKeeperTest<T>::url;
+class AllocatorZooKeeperTest : public MesosZooKeeperTest {};
// Runs TYPED_TEST(AllocatorZooKeeperTest, ...) on all AllocatorTypes.
http://git-wip-us.apache.org/repos/asf/mesos/blob/025e4695/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index c429432..8371df2 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -53,10 +53,6 @@
#include "tests/containerizer.hpp"
#include "tests/mesos.hpp"
-#ifdef MESOS_HAS_JAVA
-#include "tests/zookeeper.hpp"
-#endif
-
using namespace mesos;
using namespace mesos::internal;
using namespace mesos::internal::tests;
@@ -1299,44 +1295,8 @@ TEST_F(MasterTest, MetricsInStatsEndpoint)
#ifdef MESOS_HAS_JAVA
-class MasterZooKeeperTest : public MesosTest
-{
-public:
- static void SetUpTestCase()
- {
- // Make sure the JVM is created.
- ZooKeeperTest::SetUpTestCase();
-
- // Launch the ZooKeeper test server.
- server = new ZooKeeperTestServer();
- server->startNetwork();
-
- Try<zookeeper::URL> parse = zookeeper::URL::parse(
- "zk://" + server->connectString() + "/znode");
- ASSERT_SOME(parse);
-
- url = parse.get();
- }
-
- static void TearDownTestCase()
- {
- delete server;
- server = NULL;
- }
-
-protected:
- MasterZooKeeperTest() : MesosTest(url) {}
-
- static ZooKeeperTestServer* server;
- static Option<zookeeper::URL> url;
-};
-
-
-ZooKeeperTestServer* MasterZooKeeperTest::server = NULL;
-
-
-Option<zookeeper::URL> MasterZooKeeperTest::url;
+class MasterZooKeeperTest : public MesosZooKeeperTest {};
// This test verifies that when the ZooKeeper cluster is lost,
// master, slave & scheduler all get informed.
http://git-wip-us.apache.org/repos/asf/mesos/blob/025e4695/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index a9844e4..b9388df 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -25,6 +25,11 @@ namespace mesos {
namespace internal {
namespace tests {
+#ifdef MESOS_HAS_JAVA
+ZooKeeperTestServer* MesosZooKeeperTest::server = NULL;
+Option<zookeeper::URL> MesosZooKeeperTest::url;
+#endif // MESOS_HAS_JAVA
+
MesosTest::MesosTest(const Option<zookeeper::URL>& url) : cluster(url) {}
http://git-wip-us.apache.org/repos/asf/mesos/blob/025e4695/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 7bc5e98..0c5b570 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -54,6 +54,10 @@
#include "tests/cluster.hpp"
+#ifdef MESOS_HAS_JAVA
+#include "tests/zookeeper.hpp"
+#endif // MESOS_HAS_JAVA
+
namespace mesos {
namespace internal {
namespace tests {
@@ -196,6 +200,43 @@ protected:
#endif // __linux__
+#ifdef MESOS_HAS_JAVA
+
+class MesosZooKeeperTest : public MesosTest
+{
+public:
+ static void SetUpTestCase()
+ {
+ // Make sure the JVM is created.
+ ZooKeeperTest::SetUpTestCase();
+
+ // Launch the ZooKeeper test server.
+ server = new ZooKeeperTestServer();
+ server->startNetwork();
+
+ Try<zookeeper::URL> parse = zookeeper::URL::parse(
+ "zk://" + server->connectString() + "/znode");
+ ASSERT_SOME(parse);
+
+ url = parse.get();
+ }
+
+ static void TearDownTestCase()
+ {
+ delete server;
+ server = NULL;
+ }
+
+protected:
+ MesosZooKeeperTest() : MesosTest(url) {}
+
+ static ZooKeeperTestServer* server;
+ static Option<zookeeper::URL> url;
+};
+
+#endif // MESOS_HAS_JAVA
+
+
// Macros to get/create (default) ExecutorInfos and FrameworkInfos.
#define DEFAULT_EXECUTOR_INFO \
({ ExecutorInfo executor; \