You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2017/06/30 21:38:02 UTC
kudu git commit: tests: allow Wait calls for non-default tables
Repository: kudu
Updated Branches:
refs/heads/master 9a3071a9a -> 794285592
tests: allow Wait calls for non-default tables
WaitForReplicasAndUpdateLocations and WaitForTSAndReplicas in
TabletServerTestBase both wait for a predefined table to reach some
state. This patch adds the functionality to use these functions on a
different table.
Change-Id: Ife11c6f30579ab1c63cb80c6f5f5e7d4602fc3c6
Reviewed-on: http://gerrit.cloudera.org:8080/7244
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/79428559
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/79428559
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/79428559
Branch: refs/heads/master
Commit: 794285592600d5c1a4dbc88ab67119763e0c4c9f
Parents: 9a3071a
Author: Andrew Wong <aw...@cloudera.com>
Authored: Tue Jun 20 19:15:56 2017 -0700
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Fri Jun 30 21:37:19 2017 +0000
----------------------------------------------------------------------
src/kudu/integration-tests/ts_itest-base.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/79428559/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 5e4feaa..52978c5 100644
--- a/src/kudu/integration-tests/ts_itest-base.h
+++ b/src/kudu/integration-tests/ts_itest-base.h
@@ -136,16 +136,16 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
&tablet_servers_));
}
- // Waits that all replicas for a all tablets of 'kTableId' table are online
+ // Waits that all replicas for a all tablets of 'table_id' table are online
// and creates the tablet_replicas_ map.
- void WaitForReplicasAndUpdateLocations() {
+ void WaitForReplicasAndUpdateLocations(const string& table_id = kTableId) {
bool replicas_missing = true;
for (int num_retries = 0; replicas_missing && num_retries < kMaxRetries; num_retries++) {
std::unordered_multimap<std::string, TServerDetails*> tablet_replicas;
GetTableLocationsRequestPB req;
GetTableLocationsResponsePB resp;
RpcController controller;
- req.mutable_table()->set_table_name(kTableId);
+ req.mutable_table()->set_table_name(table_id);
controller.set_timeout(MonoDelta::FromSeconds(1));
CHECK_OK(cluster_->master_proxy()->GetTableLocations(req, &resp, &controller));
CHECK_OK(controller.status());
@@ -344,7 +344,7 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
// Gets the the locations of the consensus configuration and waits until all replicas
// are available for all tablets.
- void WaitForTSAndReplicas() {
+ void WaitForTSAndReplicas(const string& table_id = kTableId) {
int num_retries = 0;
// make sure the replicas are up and find the leader
while (true) {
@@ -361,7 +361,7 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
}
break;
}
- WaitForReplicasAndUpdateLocations();
+ WaitForReplicasAndUpdateLocations(table_id);
}
// Removes a set of servers from the replicas_ list.
@@ -491,17 +491,17 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
}
// Create a table with a single tablet, with 'num_replicas'.
- void CreateTable() {
+ void CreateTable(const string& table_id = kTableId) {
// The tests here make extensive use of server schemas, but we need
// a client schema to create the table.
client::KuduSchema client_schema(KuduSchemaFromSchema(schema_));
gscoped_ptr<client::KuduTableCreator> table_creator(client_->NewTableCreator());
- ASSERT_OK(table_creator->table_name(kTableId)
+ ASSERT_OK(table_creator->table_name(table_id)
.schema(&client_schema)
.set_range_partition_columns({ "key" })
.num_replicas(FLAGS_num_replicas)
.Create());
- ASSERT_OK(client_->OpenTable(kTableId, &table_));
+ ASSERT_OK(client_->OpenTable(table_id, &table_));
}
// Starts an external cluster with a single tablet and a number of replicas equal