You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/01/07 00:46:15 UTC

[3/8] incubator-kudu git commit: DeleteTableTest should use ExternalMiniClusterITestBase

DeleteTableTest should use ExternalMiniClusterITestBase

Removing duplicate code from DeleteTableTest. This is just test cleanup.

Change-Id: Iad374c10c2ee8ce46095b827ee4d6d11eb44605b
Reviewed-on: http://gerrit.cloudera.org:8080/1713
Tested-by: Internal Jenkins
Reviewed-by: Todd Lipcon <to...@cloudera.com>


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

Branch: refs/heads/master
Commit: dca76cadeb7a0c7ba6d08608ae42ec388584c0d0
Parents: 8b04bf9
Author: Mike Percy <mp...@cloudera.com>
Authored: Tue Jan 5 14:37:17 2016 -0800
Committer: Todd Lipcon <to...@cloudera.com>
Committed: Wed Jan 6 20:17:17 2016 +0000

----------------------------------------------------------------------
 src/kudu/integration-tests/delete_table-test.cc | 67 +-------------------
 1 file changed, 2 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/dca76cad/src/kudu/integration-tests/delete_table-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/delete_table-test.cc b/src/kudu/integration-tests/delete_table-test.cc
index ce46432..249ea71 100644
--- a/src/kudu/integration-tests/delete_table-test.cc
+++ b/src/kudu/integration-tests/delete_table-test.cc
@@ -12,34 +12,24 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include <boost/assign/list_of.hpp>
 #include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 #include <glog/stl_logging.h>
 #include <gtest/gtest.h>
 #include <tr1/memory>
-#include <tr1/unordered_map>
 #include <string>
 
-#include "kudu/client/client.h"
 #include "kudu/client/client-test-util.h"
 #include "kudu/common/wire_protocol-test-util.h"
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/cluster_itest_util.h"
 #include "kudu/integration-tests/cluster_verifier.h"
-#include "kudu/integration-tests/external_mini_cluster.h"
-#include "kudu/integration-tests/external_mini_cluster_fs_inspector.h"
+#include "kudu/integration-tests/external_mini_cluster-itest-base.h"
 #include "kudu/integration-tests/test_workload.h"
 #include "kudu/tablet/tablet.pb.h"
 #include "kudu/tserver/tserver.pb.h"
 #include "kudu/util/curl_util.h"
-#include "kudu/util/pstack_watcher.h"
-#include "kudu/util/test_util.h"
 
-using boost::assign::list_of;
-using kudu::client::KuduClient;
-using kudu::client::KuduClientBuilder;
 using kudu::client::KuduSchema;
 using kudu::client::KuduSchemaFromSchema;
 using kudu::client::KuduTableCreator;
@@ -58,34 +48,12 @@ using kudu::tserver::ListTabletsResponsePB;
 using kudu::tserver::TabletServerErrorPB;
 using std::numeric_limits;
 using std::string;
-using std::tr1::shared_ptr;
-using std::tr1::unordered_map;
 using std::vector;
 using strings::Substitute;
 
 namespace kudu {
 
-class DeleteTableTest : public KuduTest {
- public:
-  virtual void TearDown() OVERRIDE {
-    if (HasFatalFailure()) {
-      for (int i = 0; i < 3; i++) {
-        if (!cluster_->tablet_server(i)->IsProcessAlive()) {
-          LOG(INFO) << "Tablet server " << i << " is not running. Cannot dump its stacks.";
-          continue;
-        }
-        LOG(INFO) << "Attempting to dump stacks of TS " << i
-                  << " with UUID " << cluster_->tablet_server(i)->uuid()
-                  << " and pid " << cluster_->tablet_server(i)->pid();
-        WARN_NOT_OK(PstackWatcher::DumpPidStacks(cluster_->tablet_server(i)->pid()),
-                    "Couldn't dump stacks");
-      }
-    }
-    if (cluster_) cluster_->Shutdown();
-    KuduTest::TearDown();
-    STLDeleteValues(&ts_map_);
-  }
-
+class DeleteTableTest : public ExternalMiniClusterITestBase {
  protected:
   enum IsCMetaExpected {
     CMETA_NOT_EXPECTED = 0,
@@ -97,10 +65,6 @@ class DeleteTableTest : public KuduTest {
     SUPERBLOCK_EXPECTED = 1
   };
 
-  void StartCluster(const vector<string>& extra_tserver_flags = vector<string>(),
-                    const vector<string>& extra_master_flags = vector<string>(),
-                    int num_tablet_servers = 3);
-
   // Get the UUID of the leader of the specified tablet, as seen by the TS with
   // the given 'ts_uuid'.
   string GetLeaderUUID(const string& ts_uuid, const string& tablet_id);
@@ -141,35 +105,8 @@ class DeleteTableTest : public KuduTest {
   // bootstrap, are running.
   void DeleteTabletWithRetries(const TServerDetails* ts, const string& tablet_id,
                                TabletDataState delete_type, const MonoDelta& timeout);
-
-  gscoped_ptr<ExternalMiniCluster> cluster_;
-  gscoped_ptr<itest::ExternalMiniClusterFsInspector> inspect_;
-  shared_ptr<KuduClient> client_;
-  unordered_map<string, TServerDetails*> ts_map_;
 };
 
-void DeleteTableTest::StartCluster(const vector<string>& extra_tserver_flags,
-                                   const vector<string>& extra_master_flags,
-                                   int num_tablet_servers) {
-  ExternalMiniClusterOptions opts;
-  opts.num_tablet_servers = num_tablet_servers;
-  opts.extra_tserver_flags = extra_tserver_flags;
-  opts.extra_master_flags = extra_master_flags;
-
-  // Disable fsyncing, since these tests do a lot of data writing and transfer,
-  // and the fsyncs (a) make them slower, and (b) make them flaky since the syncs
-  // can take a long time on loaded build slaves.
-  opts.extra_tserver_flags.push_back("--never_fsync");
-  cluster_.reset(new ExternalMiniCluster(opts));
-  ASSERT_OK(cluster_->Start());
-  inspect_.reset(new itest::ExternalMiniClusterFsInspector(cluster_.get()));
-  ASSERT_OK(itest::CreateTabletServerMap(cluster_->master_proxy().get(),
-                                          cluster_->messenger(),
-                                          &ts_map_));
-  KuduClientBuilder builder;
-  ASSERT_OK(cluster_->CreateClient(builder, &client_));
-}
-
 string DeleteTableTest::GetLeaderUUID(const string& ts_uuid, const string& tablet_id) {
   ConsensusStatePB cstate;
   CHECK_OK(itest::GetConsensusState(ts_map_[ts_uuid], tablet_id, CONSENSUS_CONFIG_COMMITTED,