kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [6/6] kudu git commit: mini-cluster: new module for the mini cluster implementations
Date Mon, 02 Oct 2017 19:25:23 GMT
mini-cluster: new module for the mini cluster implementations

For the upcoming "control shell" patch, the Kudu CLI will need to link
ExternalMiniCluster and friends. Today that means depending on the
integration-tests target, which doesn't feel quite right since that's
mostly, well, integration tests. More practically, the integration-tests
cmake target is conditioned on !NO_TESTS but the Kudu CLI is not.

So this patch moves the mini cluster code into a standalone module. I also
took the opportunity to place the code in a new "cluster" namespace.

Change-Id: I0437e281da5874016d9c1f1404a6de043bfb4088
Reviewed-on: http://gerrit.cloudera.org:8080/8173
Tested-by: Kudu Jenkins
Reviewed-by: Dan Burkert <danburkert@apache.org>


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

Branch: refs/heads/master
Commit: 350c8a79c87c9d841ce36065687080e5a0a4ab1e
Parents: c0be237
Author: Adar Dembo <adar@cloudera.com>
Authored: Thu Sep 28 22:23:23 2017 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Mon Oct 2 19:24:57 2017 +0000

----------------------------------------------------------------------
 CMakeLists.txt                                  |    1 +
 .../benchmarks/tpch/rpc_line_item_dao-test.cc   |    4 +-
 src/kudu/benchmarks/tpch/tpch1.cc               |    8 +-
 src/kudu/benchmarks/tpch/tpch_real_world.cc     |    4 +-
 src/kudu/client/CMakeLists.txt                  |    6 +-
 src/kudu/client/client-test.cc                  |    4 +-
 src/kudu/client/predicate-test.cc               |    4 +-
 src/kudu/client/scan_token-test.cc              |    4 +-
 src/kudu/integration-tests/CMakeLists.txt       |    5 +-
 src/kudu/integration-tests/all_types-itest.cc   |    4 +-
 .../alter_table-randomized-test.cc              |    4 +-
 src/kudu/integration-tests/alter_table-test.cc  |    4 +-
 .../authn_token_expire-itest.cc                 |    4 +-
 .../catalog_manager_tsk-itest.cc                |    4 +-
 .../client-negotiation-failover-itest.cc        |    7 +-
 .../integration-tests/client-stress-test.cc     |    5 +-
 .../integration-tests/client_failover-itest.cc  |    4 +-
 src/kudu/integration-tests/cluster_verifier.cc  |    5 +-
 src/kudu/integration-tests/cluster_verifier.h   |   10 +-
 src/kudu/integration-tests/consistency-itest.cc |    2 +-
 .../integration-tests/create-table-itest.cc     |    6 +-
 .../create-table-stress-test.cc                 |    4 +-
 .../integration-tests/delete_table-itest.cc     |    3 +-
 .../integration-tests/delete_tablet-itest.cc    |    2 +-
 src/kudu/integration-tests/dense_node-itest.cc  |    3 +-
 .../integration-tests/disk_failure-itest.cc     |    3 +-
 .../integration-tests/disk_reservation-itest.cc |    4 +-
 .../exactly_once_writes-itest.cc                |    2 +-
 .../external_mini_cluster-itest-base.cc         |    7 +-
 .../external_mini_cluster-itest-base.h          |   10 +-
 .../external_mini_cluster-test.cc               |  211 ---
 .../integration-tests/external_mini_cluster.cc  | 1280 -----------------
 .../integration-tests/external_mini_cluster.h   |  564 --------
 .../external_mini_cluster_fs_inspector.cc       |    4 +-
 .../external_mini_cluster_fs_inspector.h        |   18 +-
 .../flex_partitioning-itest.cc                  |    4 +-
 .../full_stack-insert-scan-test.cc              |    4 +-
 src/kudu/integration-tests/fuzz-itest.cc        |    4 +-
 .../internal_mini_cluster-itest-base.cc         |    3 +
 .../internal_mini_cluster-itest-base.h          |    8 +-
 .../integration-tests/internal_mini_cluster.cc  |  375 -----
 .../integration-tests/internal_mini_cluster.h   |  219 ---
 .../integration-tests/linked_list-test-util.h   |    4 +-
 src/kudu/integration-tests/linked_list-test.cc  |   19 +-
 src/kudu/integration-tests/log-rolling-itest.cc |    5 +-
 src/kudu/integration-tests/log_verifier.cc      |    4 +-
 src/kudu/integration-tests/log_verifier.h       |   12 +-
 .../integration-tests/master-stress-test.cc     |    6 +-
 .../master_cert_authority-itest.cc              |    4 +-
 .../integration-tests/master_failover-itest.cc  |    7 +-
 .../integration-tests/master_migration-itest.cc |   10 +-
 .../master_replication-itest.cc                 |    6 +-
 src/kudu/integration-tests/mini_cluster.cc      |   55 -
 src/kudu/integration-tests/mini_cluster.h       |  158 ---
 .../minidump_generation-itest.cc                |    8 +-
 .../integration-tests/multidir_cluster-itest.cc |    3 +-
 .../integration-tests/open-readonly-fs-itest.cc |    4 +-
 .../raft_config_change-itest.cc                 |    2 +-
 .../integration-tests/raft_consensus-itest.cc   |    3 +-
 src/kudu/integration-tests/registration-test.cc |    3 +-
 .../integration-tests/security-faults-itest.cc  |    4 +-
 src/kudu/integration-tests/security-itest.cc    |   10 +-
 .../security-unknown-tsk-itest.cc               |    5 +-
 .../integration-tests/table_locations-itest.cc  |    4 +-
 src/kudu/integration-tests/tablet_copy-itest.cc |    6 +-
 .../tablet_copy_client_session-itest.cc         |    2 +-
 .../tablet_history_gc-itest.cc                  |    3 +-
 .../tablet_replacement-itest.cc                 |    2 +-
 src/kudu/integration-tests/test_workload.cc     |    3 +-
 src/kudu/integration-tests/test_workload.h      |    9 +-
 .../integration-tests/token_signer-itest.cc     |    4 +-
 .../tombstoned_voting-imc-itest.cc              |    2 +-
 .../tombstoned_voting-itest.cc                  |    4 +-
 .../tombstoned_voting-stress-test.cc            |    2 +-
 src/kudu/integration-tests/ts_itest-base.h      |   14 +-
 src/kudu/integration-tests/ts_recovery-itest.cc |    2 +-
 .../ts_tablet_manager-itest.cc                  |    4 +-
 .../update_scan_delta_compact-test.cc           |    4 +-
 .../integration-tests/version_migration-test.cc |    5 +-
 .../integration-tests/webserver-stress-itest.cc |    4 +-
 src/kudu/mini-cluster/CMakeLists.txt            |   51 +
 .../mini-cluster/external_mini_cluster-test.cc  |  213 +++
 src/kudu/mini-cluster/external_mini_cluster.cc  | 1281 ++++++++++++++++++
 src/kudu/mini-cluster/external_mini_cluster.h   |  568 ++++++++
 src/kudu/mini-cluster/internal_mini_cluster.cc  |  377 ++++++
 src/kudu/mini-cluster/internal_mini_cluster.h   |  222 +++
 src/kudu/mini-cluster/mini_cluster.cc           |   57 +
 src/kudu/mini-cluster/mini_cluster.h            |  161 +++
 src/kudu/tools/CMakeLists.txt                   |    1 +
 src/kudu/tools/ksck_remote-test.cc              |    4 +-
 src/kudu/tools/kudu-admin-test.cc               |    3 +-
 src/kudu/tools/kudu-tool-test.cc                |   12 +-
 src/kudu/tools/kudu-ts-cli-test.cc              |    2 +-
 93 files changed, 3181 insertions(+), 3008 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ff44b31..8bc2d15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1199,6 +1199,7 @@ add_subdirectory(src/kudu/gutil)
 add_subdirectory(src/kudu/integration-tests)
 add_subdirectory(src/kudu/kserver)
 add_subdirectory(src/kudu/master)
+add_subdirectory(src/kudu/mini-cluster)
 add_subdirectory(src/kudu/rpc)
 add_subdirectory(src/kudu/security)
 add_subdirectory(src/kudu/server)

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc b/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc
index 494360c..9eef222 100644
--- a/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc
+++ b/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc
@@ -31,8 +31,8 @@
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/stringprintf.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/mini_master.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
@@ -41,6 +41,8 @@
 namespace kudu {
 
 using client::KuduRowResult;
+using cluster::InternalMiniCluster;
+using cluster::InternalMiniClusterOptions;
 using std::string;
 using std::vector;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/benchmarks/tpch/tpch1.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/tpch1.cc b/src/kudu/benchmarks/tpch/tpch1.cc
index b87f969..d8d4a11 100644
--- a/src/kudu/benchmarks/tpch/tpch1.cc
+++ b/src/kudu/benchmarks/tpch/tpch1.cc
@@ -76,8 +76,8 @@
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/hash/city.h"
 #include "kudu/gutil/stringprintf.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/mini_master.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/util/env.h"
 #include "kudu/util/flags.h"
 #include "kudu/util/logging.h"
@@ -254,15 +254,15 @@ int main(int argc, char **argv) {
   kudu::InitGoogleLoggingSafe(argv[0]);
 
   kudu::Env* env;
-  gscoped_ptr<kudu::InternalMiniCluster> cluster;
+  gscoped_ptr<kudu::cluster::InternalMiniCluster> cluster;
   string master_address;
   if (FLAGS_use_mini_cluster) {
     env = kudu::Env::Default();
     kudu::Status s = env->CreateDir(FLAGS_mini_cluster_base_dir);
     CHECK(s.IsAlreadyPresent() || s.ok()) << s.ToString();
-    kudu::InternalMiniClusterOptions options;
+    kudu::cluster::InternalMiniClusterOptions options;
     options.data_root = FLAGS_mini_cluster_base_dir;
-    cluster.reset(new kudu::InternalMiniCluster(env, options));
+    cluster.reset(new kudu::cluster::InternalMiniCluster(env, options));
     CHECK_OK(cluster->StartSync());
     master_address = cluster->mini_master()->bound_rpc_addr_str();
   } else {

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/benchmarks/tpch/tpch_real_world.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/tpch_real_world.cc b/src/kudu/benchmarks/tpch/tpch_real_world.cc
index 8bf806f..ce65501 100644
--- a/src/kudu/benchmarks/tpch/tpch_real_world.cc
+++ b/src/kudu/benchmarks/tpch/tpch_real_world.cc
@@ -70,7 +70,7 @@
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/atomic.h"
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/env.h"
@@ -130,6 +130,8 @@ namespace kudu {
 
 using client::KuduRowResult;
 using client::KuduSchema;
+using cluster::ExternalMiniCluster;
+using cluster::ExternalMiniClusterOptions;
 using strings::Substitute;
 
 class TpchRealWorld {

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/client/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/client/CMakeLists.txt b/src/kudu/client/CMakeLists.txt
index f119994..d23e98d 100644
--- a/src/kudu/client/CMakeLists.txt
+++ b/src/kudu/client/CMakeLists.txt
@@ -254,7 +254,11 @@ endif()
 if(NOT "${KUDU_USE_ASAN}" AND NOT "${KUDU_USE_TSAN}")
   ADD_KUDU_TEST(client_samples-test.sh RUN_SERIAL true LABELS no_dist_test)
 endif()
-set(KUDU_TEST_LINK_LIBS kudu_client integration-tests ${KUDU_MIN_TEST_LIBS})
+set(KUDU_TEST_LINK_LIBS
+  integration-tests
+  kudu_client
+  mini-cluster
+  ${KUDU_MIN_TEST_LIBS})
 ADD_KUDU_TEST(client-test)
 ADD_KUDU_TEST(client-unittest)
 ADD_KUDU_TEST(predicate-test)

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/client/client-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index 6ed26be..c888513 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -74,11 +74,11 @@
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/catalog_manager.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/mini_master.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/rpc/messenger.h"
 #include "kudu/rpc/service_pool.h"
 #include "kudu/security/tls_context.h"
@@ -150,6 +150,8 @@ using base::subtle::Atomic32;
 using base::subtle::NoBarrier_AtomicIncrement;
 using base::subtle::NoBarrier_Load;
 using base::subtle::NoBarrier_Store;
+using cluster::InternalMiniCluster;
+using cluster::InternalMiniClusterOptions;
 using master::CatalogManager;
 using master::GetTableLocationsRequestPB;
 using master::GetTableLocationsResponsePB;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/client/predicate-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/predicate-test.cc b/src/kudu/client/predicate-test.cc
index 29e717c..99148ad 100644
--- a/src/kudu/client/predicate-test.cc
+++ b/src/kudu/client/predicate-test.cc
@@ -36,7 +36,7 @@
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/strings/escaping.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
@@ -50,6 +50,8 @@ using std::vector;
 namespace kudu {
 namespace client {
 
+using cluster::InternalMiniCluster;
+using cluster::InternalMiniClusterOptions;
 using sp::shared_ptr;
 
 class PredicateTest : public KuduTest {

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/client/scan_token-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/scan_token-test.cc b/src/kudu/client/scan_token-test.cc
index d315518..08b44b0 100644
--- a/src/kudu/client/scan_token-test.cc
+++ b/src/kudu/client/scan_token-test.cc
@@ -40,7 +40,7 @@
 #include "kudu/common/wire_protocol.pb.h"
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/stl_util.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/tserver/mini_tablet_server.h"
 #include "kudu/tserver/tablet_server.h"
 #include "kudu/util/net/sockaddr.h"
@@ -51,6 +51,8 @@
 namespace kudu {
 namespace client {
 
+using cluster::InternalMiniCluster;
+using cluster::InternalMiniClusterOptions;
 using sp::shared_ptr;
 using std::atomic;
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/CMakeLists.txt b/src/kudu/integration-tests/CMakeLists.txt
index 8c36fdc..8184bad 100644
--- a/src/kudu/integration-tests/CMakeLists.txt
+++ b/src/kudu/integration-tests/CMakeLists.txt
@@ -24,12 +24,9 @@ set(INTEGRATION_TESTS_SRCS
   cluster_itest_util.cc
   cluster_verifier.cc
   external_mini_cluster-itest-base.cc
-  external_mini_cluster.cc
   external_mini_cluster_fs_inspector.cc
   internal_mini_cluster-itest-base.cc
-  internal_mini_cluster.cc
   log_verifier.cc
-  mini_cluster.cc
   test_workload.cc
 )
 
@@ -38,6 +35,7 @@ target_link_libraries(integration-tests
   tserver
   tserver_test_util
   master
+  mini-cluster
   ksck
   kudu_client
   kudu_client_test_util
@@ -71,7 +69,6 @@ ADD_KUDU_TEST(delete_tablet-itest)
 ADD_KUDU_TEST(disk_failure-itest)
 ADD_KUDU_TEST(disk_reservation-itest)
 ADD_KUDU_TEST(exactly_once_writes-itest)
-ADD_KUDU_TEST(external_mini_cluster-test RESOURCE_LOCK "master-rpc-ports")
 ADD_KUDU_TEST(flex_partitioning-itest TIMEOUT 1800)
 ADD_KUDU_TEST(full_stack-insert-scan-test RUN_SERIAL true)
 ADD_KUDU_TEST(fuzz-itest RUN_SERIAL true)

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/all_types-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/all_types-itest.cc b/src/kudu/integration-tests/all_types-itest.cc
index 8b5d534..f9c9309 100644
--- a/src/kudu/integration-tests/all_types-itest.cc
+++ b/src/kudu/integration-tests/all_types-itest.cc
@@ -43,7 +43,7 @@
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/gutil/type_traits.h"
 #include "kudu/integration-tests/cluster_verifier.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/bitmap.h"
 #include "kudu/util/slice.h"
 #include "kudu/util/status.h"
@@ -58,6 +58,8 @@ using std::vector;
 namespace kudu {
 namespace client {
 
+using cluster::ExternalMiniCluster;
+using cluster::ExternalMiniClusterOptions;
 using sp::shared_ptr;
 
 static const int kNumTabletServers = 3;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/alter_table-randomized-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/alter_table-randomized-test.cc b/src/kudu/integration-tests/alter_table-randomized-test.cc
index 86f7767..a368ef0 100644
--- a/src/kudu/integration-tests/alter_table-randomized-test.cc
+++ b/src/kudu/integration-tests/alter_table-randomized-test.cc
@@ -42,7 +42,7 @@
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_verifier.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/random.h"
 #include "kudu/util/status.h"
@@ -65,6 +65,8 @@ using client::KuduTableCreator;
 using client::KuduValue;
 using client::KuduWriteOperation;
 using client::sp::shared_ptr;
+using cluster::ExternalMiniCluster;
+using cluster::ExternalMiniClusterOptions;
 using std::make_pair;
 using std::map;
 using std::pair;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/alter_table-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/alter_table-test.cc b/src/kudu/integration-tests/alter_table-test.cc
index 55caef0..815ed34 100644
--- a/src/kudu/integration-tests/alter_table-test.cc
+++ b/src/kudu/integration-tests/alter_table-test.cc
@@ -51,11 +51,11 @@
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/catalog_manager.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/mini_master.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/tablet/rowset.h"
 #include "kudu/tablet/tablet.h"
 #include "kudu/tablet/tablet_metadata.h"
@@ -97,6 +97,8 @@ using client::KuduTableCreator;
 using client::KuduUpdate;
 using client::KuduValue;
 using client::sp::shared_ptr;
+using cluster::InternalMiniCluster;
+using cluster::InternalMiniClusterOptions;
 using master::AlterTableRequestPB;
 using master::AlterTableResponsePB;
 using std::atomic;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/authn_token_expire-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/authn_token_expire-itest.cc b/src/kudu/integration-tests/authn_token_expire-itest.cc
index f48df14..81fdfc5 100644
--- a/src/kudu/integration-tests/authn_token_expire-itest.cc
+++ b/src/kudu/integration-tests/authn_token_expire-itest.cc
@@ -33,8 +33,8 @@
 #include "kudu/common/partial_row.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_verifier.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/test_workload.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/tablet/key_value_test_schema.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/status.h"
@@ -50,6 +50,8 @@ using strings::Substitute;
 namespace kudu {
 namespace client {
 
+using cluster::ExternalMiniCluster;
+using cluster::ExternalMiniClusterOptions;
 using sp::shared_ptr;
 
 namespace {

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/catalog_manager_tsk-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/catalog_manager_tsk-itest.cc b/src/kudu/integration-tests/catalog_manager_tsk-itest.cc
index acdeba9..0a0a0e4 100644
--- a/src/kudu/integration-tests/catalog_manager_tsk-itest.cc
+++ b/src/kudu/integration-tests/catalog_manager_tsk-itest.cc
@@ -32,7 +32,7 @@
 #include "kudu/common/partial_row.h"
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/tablet/key_value_test_schema.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/test_macros.h"
@@ -45,6 +45,8 @@ using kudu::client::KuduSchema;
 using kudu::client::KuduSession;
 using kudu::client::KuduTable;
 using kudu::client::KuduTableCreator;
+using kudu::cluster::ExternalMiniCluster;
+using kudu::cluster::ExternalMiniClusterOptions;
 using std::back_inserter;
 using std::copy;
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/client-negotiation-failover-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/client-negotiation-failover-itest.cc b/src/kudu/integration-tests/client-negotiation-failover-itest.cc
index 69327d2..5ff646d 100644
--- a/src/kudu/integration-tests/client-negotiation-failover-itest.cc
+++ b/src/kudu/integration-tests/client-negotiation-failover-itest.cc
@@ -34,7 +34,7 @@
 #include "kudu/client/write_op.h"
 #include "kudu/common/partial_row.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/tablet/key_value_test_schema.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/scoped_cleanup.h"
@@ -50,6 +50,11 @@ using kudu::client::KuduSchema;
 using kudu::client::KuduTable;
 using kudu::client::KuduTableCreator;
 using kudu::client::sp::shared_ptr;
+using kudu::cluster::ExternalMaster;
+using kudu::cluster::ExternalMiniCluster;
+using kudu::cluster::ExternalMiniClusterOptions;
+using kudu::cluster::ExternalTabletServer;
+using kudu::cluster::ScopedResumeExternalDaemon;
 using std::string;
 using std::thread;
 using std::unique_ptr;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/client-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/client-stress-test.cc b/src/kudu/integration-tests/client-stress-test.cc
index 569171e..c1565ac 100644
--- a/src/kudu/integration-tests/client-stress-test.cc
+++ b/src/kudu/integration-tests/client-stress-test.cc
@@ -38,8 +38,8 @@
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/test_workload.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/metrics.h"
 #include "kudu/util/monotime.h"
@@ -62,9 +62,10 @@ using std::vector;
 namespace kudu {
 
 using client::KuduClient;
-using client::KuduClientBuilder;
 using client::KuduScanner;
 using client::KuduTable;
+using cluster::ExternalMiniCluster;
+using cluster::ExternalMiniClusterOptions;
 
 class ClientStressTest : public KuduTest {
  public:

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/client_failover-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/client_failover-itest.cc b/src/kudu/integration-tests/client_failover-itest.cc
index b2f89d8..afbc786 100644
--- a/src/kudu/integration-tests/client_failover-itest.cc
+++ b/src/kudu/integration-tests/client_failover-itest.cc
@@ -38,9 +38,9 @@
 #include "kudu/gutil/map-util.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
 #include "kudu/integration-tests/external_mini_cluster-itest-base.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/external_mini_cluster_fs_inspector.h"
 #include "kudu/integration-tests/test_workload.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/tablet/metadata.pb.h"
 #include "kudu/tablet/tablet.pb.h"
 #include "kudu/tserver/tserver.pb.h"
@@ -55,6 +55,8 @@ using kudu::client::KuduSession;
 using kudu::client::KuduTable;
 using kudu::client::KuduUpdate;
 using kudu::client::sp::shared_ptr;
+using kudu::cluster::ExternalTabletServer;
+using kudu::cluster::ScopedResumeExternalDaemon;
 using kudu::itest::TServerDetails;
 using kudu::tablet::TABLET_DATA_TOMBSTONED;
 using std::set;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/cluster_verifier.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/cluster_verifier.cc b/src/kudu/integration-tests/cluster_verifier.cc
index 97f3941..1659560 100644
--- a/src/kudu/integration-tests/cluster_verifier.cc
+++ b/src/kudu/integration-tests/cluster_verifier.cc
@@ -28,11 +28,13 @@
 #include "kudu/client/row_result.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_verifier.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/log_verifier.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
+#include "kudu/tools/ksck.h"
 #include "kudu/tools/ksck_remote.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/net/net_util.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
@@ -41,6 +43,7 @@ using std::vector;
 
 namespace kudu {
 
+using cluster::ExternalMiniCluster;
 using strings::Substitute;
 using tools::Ksck;
 using tools::KsckCluster;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/cluster_verifier.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/cluster_verifier.h b/src/kudu/integration-tests/cluster_verifier.h
index e2e601f..575cd5b 100644
--- a/src/kudu/integration-tests/cluster_verifier.h
+++ b/src/kudu/integration-tests/cluster_verifier.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_INTEGRATION_TESTS_CLUSTER_VERIFIER_H
-#define KUDU_INTEGRATION_TESTS_CLUSTER_VERIFIER_H
+#pragma once
 
 #include <string>
 
@@ -26,12 +25,14 @@
 
 namespace kudu {
 
+namespace cluster {
 class ExternalMiniCluster;
+} // namespace cluster
 
 // Utility class for integration tests to verify that the cluster is in a good state.
 class ClusterVerifier {
  public:
-  explicit ClusterVerifier(ExternalMiniCluster* cluster);
+  explicit ClusterVerifier(cluster::ExternalMiniCluster* cluster);
 
   // Set the timeout for read/write/admin operations.
   void SetOperationsTimeout(const MonoDelta& timeout);
@@ -85,7 +86,7 @@ class ClusterVerifier {
                          int expected_row_count);
 
 
-  ExternalMiniCluster* cluster_;
+  cluster::ExternalMiniCluster* cluster_;
 
   tools::ChecksumOptions checksum_options_;
 
@@ -95,4 +96,3 @@ class ClusterVerifier {
 };
 
 } // namespace kudu
-#endif /* KUDU_INTEGRATION_TESTS_CLUSTER_VERIFIER_H */

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/consistency-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/consistency-itest.cc b/src/kudu/integration-tests/consistency-itest.cc
index 3c37258..76aad69 100644
--- a/src/kudu/integration-tests/consistency-itest.cc
+++ b/src/kudu/integration-tests/consistency-itest.cc
@@ -46,11 +46,11 @@
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/internal_mini_cluster-itest-base.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/catalog_manager.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/mini_master.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/tablet/tablet_replica.h"
 #include "kudu/tserver/mini_tablet_server.h"
 #include "kudu/tserver/tablet_server.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/create-table-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/create-table-itest.cc b/src/kudu/integration-tests/create-table-itest.cc
index 3c0d097..257463d 100644
--- a/src/kudu/integration-tests/create-table-itest.cc
+++ b/src/kudu/integration-tests/create-table-itest.cc
@@ -42,11 +42,11 @@
 #include "kudu/gutil/mathlimits.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/integration-tests/external_mini_cluster-itest-base.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/external_mini_cluster_fs_inspector.h"
-#include "kudu/integration-tests/mini_cluster.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/master.proxy.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
+#include "kudu/mini-cluster/mini_cluster.h"
 #include "kudu/rpc/rpc_controller.h"
 #include "kudu/util/atomic.h"
 #include "kudu/util/metrics.h"
@@ -66,6 +66,8 @@ METRIC_DECLARE_histogram(handler_latency_kudu_tserver_TabletServerAdminService_C
 
 namespace kudu {
 
+using cluster::ClusterNodes;
+
 const char* const kTableName = "test-table";
 
 class CreateTableITest : public ExternalMiniClusterITestBase {

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/create-table-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/create-table-stress-test.cc b/src/kudu/integration-tests/create-table-stress-test.cc
index 18f63ad..35cbdf0 100644
--- a/src/kudu/integration-tests/create-table-stress-test.cc
+++ b/src/kudu/integration-tests/create-table-stress-test.cc
@@ -40,13 +40,13 @@
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/catalog_manager.h"
 #include "kudu/master/master-test-util.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/master.proxy.h"
 #include "kudu/master/mini_master.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/rpc/messenger.h"
 #include "kudu/util/atomic.h"
 #include "kudu/util/cow_object.h"
@@ -64,6 +64,8 @@ using kudu::client::KuduColumnSchema;
 using kudu::client::KuduSchema;
 using kudu::client::KuduSchemaBuilder;
 using kudu::client::KuduTableCreator;
+using kudu::cluster::InternalMiniCluster;
+using kudu::cluster::InternalMiniClusterOptions;
 using kudu::itest::CreateTabletServerMap;
 using kudu::itest::TabletServerMap;
 using kudu::master::MasterServiceProxy;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/delete_table-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/delete_table-itest.cc b/src/kudu/integration-tests/delete_table-itest.cc
index f824db4..23f9be6 100644
--- a/src/kudu/integration-tests/delete_table-itest.cc
+++ b/src/kudu/integration-tests/delete_table-itest.cc
@@ -54,11 +54,11 @@
 #include "kudu/integration-tests/cluster_itest_util.h"
 #include "kudu/integration-tests/cluster_verifier.h"
 #include "kudu/integration-tests/external_mini_cluster-itest-base.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/external_mini_cluster_fs_inspector.h"
 #include "kudu/integration-tests/test_workload.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/master.proxy.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/rpc/rpc_controller.h"
 #include "kudu/tablet/metadata.pb.h"
 #include "kudu/tablet/tablet.pb.h"
@@ -85,6 +85,7 @@ using kudu::client::KuduSchema;
 using kudu::client::KuduSchemaFromSchema;
 using kudu::client::KuduTable;
 using kudu::client::KuduTableCreator;
+using kudu::cluster::ExternalTabletServer;
 using kudu::consensus::COMMITTED_OPID;
 using kudu::consensus::ConsensusMetadataPB;
 using kudu::consensus::ConsensusStatePB;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/delete_tablet-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/delete_tablet-itest.cc b/src/kudu/integration-tests/delete_tablet-itest.cc
index 0dce3fb..139bb11 100644
--- a/src/kudu/integration-tests/delete_tablet-itest.cc
+++ b/src/kudu/integration-tests/delete_tablet-itest.cc
@@ -31,9 +31,9 @@
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
 #include "kudu/integration-tests/internal_mini_cluster-itest-base.h"
-#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/integration-tests/test_workload.h"
 #include "kudu/master/mini_master.h"
+#include "kudu/mini-cluster/internal_mini_cluster.h"
 #include "kudu/tablet/metadata.pb.h"
 #include "kudu/tablet/tablet.h"
 #include "kudu/tablet/tablet_replica.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/dense_node-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/dense_node-itest.cc b/src/kudu/integration-tests/dense_node-itest.cc
index 5537288..02f278c 100644
--- a/src/kudu/integration-tests/dense_node-itest.cc
+++ b/src/kudu/integration-tests/dense_node-itest.cc
@@ -32,8 +32,8 @@
 #include "kudu/client/schema.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/external_mini_cluster-itest-base.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/test_workload.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/env.h"
 #include "kudu/util/metrics.h"
 #include "kudu/util/monotime.h"
@@ -66,6 +66,7 @@ namespace kudu {
 using client::KuduColumnSchema;
 using client::KuduSchema;
 using client::KuduSchemaBuilder;
+using cluster::ExternalMiniClusterOptions;
 using std::pair;
 using std::string;
 using std::unique_ptr;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/disk_failure-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/disk_failure-itest.cc b/src/kudu/integration-tests/disk_failure-itest.cc
index a59f4a5..ff240f0 100644
--- a/src/kudu/integration-tests/disk_failure-itest.cc
+++ b/src/kudu/integration-tests/disk_failure-itest.cc
@@ -25,8 +25,8 @@
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_verifier.h"
 #include "kudu/integration-tests/external_mini_cluster-itest-base.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/test_workload.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/metrics.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/path_util.h"
@@ -37,6 +37,7 @@ METRIC_DECLARE_gauge_uint64(data_dirs_failed);
 
 namespace kudu {
 
+using cluster::ExternalTabletServer;
 using std::string;
 using std::vector;
 using strings::Substitute;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/disk_reservation-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/disk_reservation-itest.cc b/src/kudu/integration-tests/disk_reservation-itest.cc
index b80604e..e25582f 100644
--- a/src/kudu/integration-tests/disk_reservation-itest.cc
+++ b/src/kudu/integration-tests/disk_reservation-itest.cc
@@ -26,8 +26,8 @@
 
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/external_mini_cluster-itest-base.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/test_workload.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/metrics.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/status.h"
@@ -42,6 +42,8 @@ METRIC_DECLARE_gauge_uint64(data_dirs_full);
 
 namespace kudu {
 
+using cluster::ExternalTabletServer;
+
 namespace {
 Status GetTsCounterValue(ExternalTabletServer* ets, MetricPrototype* metric, int64_t* value) {
   return ets->GetInt64Metric(

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/exactly_once_writes-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/exactly_once_writes-itest.cc b/src/kudu/integration-tests/exactly_once_writes-itest.cc
index 400e5e7..1595432 100644
--- a/src/kudu/integration-tests/exactly_once_writes-itest.cc
+++ b/src/kudu/integration-tests/exactly_once_writes-itest.cc
@@ -34,9 +34,9 @@
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/log_verifier.h"
 #include "kudu/integration-tests/ts_itest-base.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/rpc/messenger.h"
 #include "kudu/rpc/rpc_controller.h"
 #include "kudu/rpc/rpc_header.pb.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/external_mini_cluster-itest-base.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster-itest-base.cc b/src/kudu/integration-tests/external_mini_cluster-itest-base.cc
index 0a22c9e..9fa12ff 100644
--- a/src/kudu/integration-tests/external_mini_cluster-itest-base.cc
+++ b/src/kudu/integration-tests/external_mini_cluster-itest-base.cc
@@ -28,10 +28,10 @@
 
 #include "kudu/gutil/stl_util.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/external_mini_cluster_fs_inspector.h"
-#include "kudu/util/status.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/pstack_watcher.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 
 DEFINE_bool(test_dump_stacks_on_failure, true,
@@ -39,6 +39,9 @@ DEFINE_bool(test_dump_stacks_on_failure, true,
 
 namespace kudu {
 
+using cluster::ExternalMiniCluster;
+using cluster::ExternalMiniClusterOptions;
+
 void ExternalMiniClusterITestBase::TearDown() {
   StopCluster();
   KuduTest::TearDown();

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/external_mini_cluster-itest-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster-itest-base.h b/src/kudu/integration-tests/external_mini_cluster-itest-base.h
index 9032c1a..963930e 100644
--- a/src/kudu/integration-tests/external_mini_cluster-itest-base.h
+++ b/src/kudu/integration-tests/external_mini_cluster-itest-base.h
@@ -23,19 +23,19 @@
 #include <vector>
 
 #include "kudu/client/shared_ptr.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/external_mini_cluster_fs_inspector.h"
+#include "kudu/mini-cluster/external_mini_cluster.h"
 #include "kudu/util/test_util.h"
 
 namespace kudu {
 
 namespace client {
 class KuduClient;
-}
+} // namespace client
 
 namespace itest {
 struct TServerDetails;
-}
+} // namespace itest
 
 // Simple base utility class to provide an external mini cluster with common
 // setup routines useful for integration tests.
@@ -49,11 +49,11 @@ class ExternalMiniClusterITestBase : public KuduTest {
                     int num_tablet_servers = 3,
                     int num_data_dirs = 1);
 
-  void StartClusterWithOpts(ExternalMiniClusterOptions opts);
+  void StartClusterWithOpts(cluster::ExternalMiniClusterOptions opts);
 
   void StopCluster();
 
-  std::unique_ptr<ExternalMiniCluster> cluster_;
+  std::unique_ptr<cluster::ExternalMiniCluster> cluster_;
   std::unique_ptr<itest::ExternalMiniClusterFsInspector> inspect_;
   client::sp::shared_ptr<client::KuduClient> client_;
   std::unordered_map<std::string, itest::TServerDetails*> ts_map_;

http://git-wip-us.apache.org/repos/asf/kudu/blob/350c8a79/src/kudu/integration-tests/external_mini_cluster-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster-test.cc b/src/kudu/integration-tests/external_mini_cluster-test.cc
deleted file mode 100644
index 9a399fa..0000000
--- a/src/kudu/integration-tests/external_mini_cluster-test.cc
+++ /dev/null
@@ -1,211 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include <cstdint>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include <glog/logging.h>
-#include <gtest/gtest.h>
-
-#include "kudu/gutil/strings/substitute.h"
-#include "kudu/gutil/strings/util.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
-#include "kudu/integration-tests/mini_cluster.h"
-#include "kudu/security/test/mini_kdc.h"
-#include "kudu/util/metrics.h"
-#include "kudu/util/monotime.h"
-#include "kudu/util/net/net_util.h"
-#include "kudu/util/status.h"
-#include "kudu/util/test_macros.h"
-#include "kudu/util/test_util.h"
-
-METRIC_DECLARE_entity(server);
-METRIC_DECLARE_gauge_uint64(threads_running);
-
-namespace kudu {
-
-using std::string;
-using strings::Substitute;
-
-enum KerberosMode {
-  WITHOUT_KERBEROS, WITH_KERBEROS
-};
-
-class ExternalMiniClusterTest : public KuduTest,
-                                public testing::WithParamInterface<KerberosMode> {};
-
-INSTANTIATE_TEST_CASE_P(KerberosOnAndOff,
-                        ExternalMiniClusterTest,
-                        ::testing::Values(WITHOUT_KERBEROS, WITH_KERBEROS));
-
-void SmokeTestKerberizedCluster(ExternalMiniClusterOptions opts) {
-  ASSERT_TRUE(opts.enable_kerberos);
-  int num_tservers = opts.num_tablet_servers;
-
-  ExternalMiniCluster cluster(std::move(opts));
-  ASSERT_OK(cluster.Start());
-
-  // Sleep long enough to ensure that the tserver's ticket would have expired
-  // if not for the renewal thread doing its thing.
-  SleepFor(MonoDelta::FromSeconds(16));
-
-  // Re-kinit for the client, since the client's ticket would have expired as well
-  // since the renewal thread doesn't run for the test client.
-  ASSERT_OK(cluster.kdc()->Kinit("test-admin"));
-
-  // Restart the master, and make sure the tserver is still able to reconnect and
-  // authenticate.
-  cluster.master(0)->Shutdown();
-  ASSERT_OK(cluster.master(0)->Restart());
-  // Ensure that all of the tablet servers can register with the masters.
-  ASSERT_OK(cluster.WaitForTabletServerCount(num_tservers, MonoDelta::FromSeconds(30)));
-  cluster.Shutdown();
-}
-
-TEST_F(ExternalMiniClusterTest, TestKerberosReacquire) {
-  if (!AllowSlowTests()) return;
-
-  ExternalMiniClusterOptions opts;
-  opts.enable_kerberos = true;
-  // Set the kerberos ticket lifetime as 15 seconds to force ticket reacquisition every 15 seconds.
-  // Note that we do not renew tickets but always acquire a new one.
-  opts.mini_kdc_options.ticket_lifetime = "15s";
-  opts.num_tablet_servers = 1;
-
-  SmokeTestKerberizedCluster(std::move(opts));
-}
-
-TEST_P(ExternalMiniClusterTest, TestBasicOperation) {
-  ExternalMiniClusterOptions opts;
-  opts.enable_kerberos = GetParam() == WITH_KERBEROS;
-
-  // Hard-coded RPC ports for the masters. This is safe, as this unit test
-  // runs under a resource lock (see CMakeLists.txt in this directory).
-  // TODO we should have a generic method to obtain n free ports.
-  opts.master_rpc_ports = { 11010, 11011, 11012 };
-  opts.num_masters = opts.master_rpc_ports.size();
-  opts.num_tablet_servers = 3;
-
-  ExternalMiniCluster cluster(opts);
-  ASSERT_OK(cluster.Start());
-
-  // Verify each of the masters.
-  for (int i = 0; i < opts.num_masters; i++) {
-    SCOPED_TRACE(i);
-    ExternalMaster* master = CHECK_NOTNULL(cluster.master(i));
-    HostPort master_rpc = master->bound_rpc_hostport();
-    string expected_prefix = Substitute("$0:", cluster.GetBindIpForMaster(i));
-    if (cluster.bind_mode() == MiniCluster::UNIQUE_LOOPBACK) {
-      EXPECT_NE(expected_prefix, "127.0.0.1:") << "Should bind to unique per-server hosts";
-    }
-    EXPECT_TRUE(HasPrefixString(master_rpc.ToString(), expected_prefix)) << master_rpc.ToString();
-
-    HostPort master_http = master->bound_http_hostport();
-    EXPECT_TRUE(HasPrefixString(master_http.ToString(), expected_prefix)) << master_http.ToString();
-
-    // Retrieve a thread metric, which should always be present on any master.
-    int64_t value;
-    ASSERT_OK(master->GetInt64Metric(&METRIC_ENTITY_server,
-                                     "kudu.master",
-                                     &METRIC_threads_running,
-                                     "value",
-                                     &value));
-    EXPECT_GT(value, 0);
-  }
-
-  // Verify each of the tablet servers.
-  for (int i = 0; i < opts.num_tablet_servers; i++) {
-    SCOPED_TRACE(i);
-    ExternalTabletServer* ts = CHECK_NOTNULL(cluster.tablet_server(i));
-    HostPort ts_rpc = ts->bound_rpc_hostport();
-    string expected_prefix = Substitute("$0:", cluster.GetBindIpForTabletServer(i));
-    if (cluster.bind_mode() == MiniCluster::UNIQUE_LOOPBACK) {
-      EXPECT_NE(expected_prefix, "127.0.0.1:") << "Should bind to unique per-server hosts";
-    }
-    EXPECT_TRUE(HasPrefixString(ts_rpc.ToString(), expected_prefix)) << ts_rpc.ToString();
-
-    HostPort ts_http = ts->bound_http_hostport();
-    EXPECT_TRUE(HasPrefixString(ts_http.ToString(), expected_prefix)) << ts_http.ToString();
-
-    // Retrieve a thread metric, which should always be present on any TS.
-    int64_t value;
-    ASSERT_OK(ts->GetInt64Metric(&METRIC_ENTITY_server,
-                                 "kudu.tabletserver",
-                                 &METRIC_threads_running,
-                                 "value",
-                                 &value));
-    EXPECT_GT(value, 0);
-  }
-
-  // Ensure that all of the tablet servers can register with the masters.
-  ASSERT_OK(cluster.WaitForTabletServerCount(opts.num_tablet_servers, MonoDelta::FromSeconds(30)));
-
-  // Restart a master and a tablet server. Make sure they come back up with the same ports.
-  ExternalMaster* master = cluster.master(0);
-  HostPort master_rpc = master->bound_rpc_hostport();
-  HostPort master_http = master->bound_http_hostport();
-
-  master->Shutdown();
-  ASSERT_OK(master->Restart());
-
-  ASSERT_EQ(master_rpc.ToString(), master->bound_rpc_hostport().ToString());
-  ASSERT_EQ(master_http.ToString(), master->bound_http_hostport().ToString());
-
-  ExternalTabletServer* ts = cluster.tablet_server(0);
-
-  HostPort ts_rpc = ts->bound_rpc_hostport();
-  HostPort ts_http = ts->bound_http_hostport();
-
-  ts->Shutdown();
-  ASSERT_OK(ts->Restart());
-
-  ASSERT_EQ(ts_rpc.ToString(), ts->bound_rpc_hostport().ToString());
-  ASSERT_EQ(ts_http.ToString(), ts->bound_http_hostport().ToString());
-
-  // Verify that, in a Kerberized cluster, if we drop our Kerberos environment,
-  // we can't make RPCs to a server.
-  if (opts.enable_kerberos) {
-    ASSERT_OK(cluster.kdc()->Kdestroy());
-    Status s = cluster.SetFlag(ts, "foo", "bar");
-    // The error differs depending on the version of Kerberos, so we match
-    // either message.
-    ASSERT_STR_MATCHES(s.ToString(), "Not authorized.*"
-                       "(Credentials cache file.*not found|"
-                        "No Kerberos credentials|"
-                        ".*No such file or directory)");
-  }
-
-  // Test that if we inject a fault into a tablet server's boot process
-  // ExternalTabletServer::Restart() still returns OK, even if the tablet server crashed.
-  ts->Shutdown();
-  ts->mutable_flags()->push_back("--fault_before_start=1.0");
-  ASSERT_OK(ts->Restart());
-  ASSERT_FALSE(ts->IsProcessAlive());
-  // Since the process should have already crashed, waiting for an injected crash with no
-  // timeout should still return OK.
-  ASSERT_OK(ts->WaitForInjectedCrash(MonoDelta::FromSeconds(0)));
-  ts->mutable_flags()->pop_back();
-  ts->Shutdown();
-  ASSERT_OK(ts->Restart());
-  ASSERT_TRUE(ts->IsProcessAlive());
-
-  cluster.Shutdown();
-}
-
-} // namespace kudu


Mime
View raw message