kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject kudu git commit: [test] optional table creation in TabletServerIntegrationTestBase
Date Fri, 02 Nov 2018 22:58:55 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 6548ea5b2 -> 71c1aa680


[test] optional table creation in TabletServerIntegrationTestBase

Creation of the test table in TabletServerIntegrationTestBase is now
optional.  If not specified otherwise, the test table is created by
default, preserving the original behavior.

The motivation for this change is that sometimes a derived test
might need the functionality of the TabletServerIntegrationTestBase
but expects not a single table created after SetUp().

The updated behavior will be used in a follow-up patch.

Change-Id: I818a2eaf76fdee11ae792c27eddae311b775efeb
Reviewed-on: http://gerrit.cloudera.org:8080/11861
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: 71c1aa6800e3919bab611e21886d3afaab2fd124
Parents: 6548ea5
Author: Alexey Serbin <alexey@apache.org>
Authored: Fri Nov 2 00:31:46 2018 -0700
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Fri Nov 2 21:07:58 2018 +0000

----------------------------------------------------------------------
 src/kudu/integration-tests/ts_itest-base.cc | 26 ++++++++++++++++--------
 src/kudu/integration-tests/ts_itest-base.h  | 10 ++++++---
 2 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/71c1aa68/src/kudu/integration-tests/ts_itest-base.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_itest-base.cc b/src/kudu/integration-tests/ts_itest-base.cc
index 8b5c5af..cdbc4a1 100644
--- a/src/kudu/integration-tests/ts_itest-base.cc
+++ b/src/kudu/integration-tests/ts_itest-base.cc
@@ -372,11 +372,8 @@ TServerDetails* TabletServerIntegrationTestBase::GetReplicaWithUuidOrNull(
   return nullptr;
 }
 
-// Gets the the locations of the consensus configuration and waits until all replicas
-// are available for all tablets.
-void TabletServerIntegrationTestBase::WaitForTSAndReplicas(const string& table_id) {
+void TabletServerIntegrationTestBase::WaitForTabletServers() {
   int num_retries = 0;
-  // make sure the replicas are up and find the leader
   while (true) {
     if (num_retries >= kMaxRetries) {
       FAIL() << " Reached max. retries while looking up the config.";
@@ -391,6 +388,12 @@ void TabletServerIntegrationTestBase::WaitForTSAndReplicas(const string&
table_i
     }
     break;
   }
+}
+
+// Gets the the locations of the consensus configuration and waits until all replicas
+// are available for all tablets.
+void TabletServerIntegrationTestBase::WaitForTSAndReplicas(const string& table_id) {
+  WaitForTabletServers();
   WaitForReplicasAndUpdateLocations(table_id);
 }
 
@@ -538,15 +541,20 @@ void TabletServerIntegrationTestBase::CreateTable(const string&
table_id) {
 void TabletServerIntegrationTestBase::BuildAndStart(
     vector<string> ts_flags,
     vector<string> master_flags,
-    LocationInfo location_info) {
+    LocationInfo location_info,
+    bool create_table) {
   NO_FATALS(CreateCluster("raft_consensus-itest-cluster",
                           std::move(ts_flags), std::move(master_flags),
                           std::move(location_info)));
   NO_FATALS(CreateClient(&client_));
-  NO_FATALS(CreateTable());
-  WaitForTSAndReplicas();
-  ASSERT_FALSE(tablet_replicas_.empty());
-  tablet_id_ = (*tablet_replicas_.begin()).first;
+  if (create_table) {
+    NO_FATALS(CreateTable());
+    WaitForTSAndReplicas();
+    ASSERT_FALSE(tablet_replicas_.empty());
+    tablet_id_ = tablet_replicas_.begin()->first;
+  } else {
+    WaitForTabletServers();
+  }
 }
 
 void TabletServerIntegrationTestBase::AssertAllReplicasAgree(int expected_result_count) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/71c1aa68/src/kudu/integration-tests/ts_itest-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_itest-base.h b/src/kudu/integration-tests/ts_itest-base.h
index 4cea4a3..1594a21 100644
--- a/src/kudu/integration-tests/ts_itest-base.h
+++ b/src/kudu/integration-tests/ts_itest-base.h
@@ -85,8 +85,11 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
   itest::TServerDetails* GetReplicaWithUuidOrNull(const std::string& tablet_id,
                                                   const std::string& uuid);
 
-  // Gets the the locations of the consensus configuration and waits until all replicas
-  // are available for all tablets.
+  // Wait for tablet servers to start up.
+  void WaitForTabletServers();
+
+  // Wait for tablet servers to start and all replicas are available for all
+  // the test table's tablets.
   void WaitForTSAndReplicas(const std::string& table_id = kTableId);
 
   // Removes a set of servers from the replicas_ list.
@@ -123,7 +126,8 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
   // mapping rules can be passed using the 'location_info' parameter.
   void BuildAndStart(std::vector<std::string> ts_flags = {},
                      std::vector<std::string> master_flags = {},
-                     cluster::LocationInfo location_info = {});
+                     cluster::LocationInfo location_info = {},
+                     bool create_table = true);
 
   void AssertAllReplicasAgree(int expected_result_count);
 


Mime
View raw message