Repository: kudu Updated Branches: refs/heads/master fbaa7dce9 -> 5f8442ff6
[client-test] fix for TestLastErrorEmbeddedInScanTimeoutStatus Stop injecting a latency on tserver shutdown in the ClientTest.TestLastErrorEmbeddedInScanTimeoutStatus test, so the tablet servers are shutting down faster, making the overall test runtime shorter (~4 vs ~16 seconds). Besides, it makes it less likely that some other process binds to the port where the tserver's webserver is about to re-bind upon restart. Change-Id: If959b53616a3c0cc1193d57d181f4b0ff034cc83 Reviewed-on: http://gerrit.cloudera.org:8080/7017 Tested-by: Kudu Jenkins Reviewed-by: Todd Lipcon <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/a71a443d Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/a71a443d Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/a71a443d Branch: refs/heads/master Commit: a71a443d2e732c40392a5f2d4499469737361154 Parents: fbaa7dc Author: Alexey Serbin <[email protected]> Authored: Tue May 30 11:14:15 2017 -0700 Committer: Alexey Serbin <[email protected]> Committed: Thu Jun 1 22:58:22 2017 +0000 ---------------------------------------------------------------------- src/kudu/client/client-test.cc | 44 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/a71a443d/src/kudu/client/client-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc index 8e79e32..244b80c 100644 --- a/src/kudu/client/client-test.cc +++ b/src/kudu/client/client-test.cc @@ -70,10 +70,10 @@ #include "kudu/util/test_util.h" #include "kudu/util/thread.h" +DECLARE_bool(allow_unsafe_replication_factor); DECLARE_bool(fail_dns_resolution); DECLARE_bool(log_inject_latency); DECLARE_bool(master_support_connect_to_master_rpc); -DECLARE_bool(allow_unsafe_replication_factor); DECLARE_int32(heartbeat_interval_ms); DECLARE_int32(leader_failure_exp_backoff_max_delta_ms); DECLARE_int32(log_inject_latency_ms_mean); @@ -4771,29 +4771,31 @@ TEST_F(ClientTest, TestLastErrorEmbeddedInScanTimeoutStatus) { NO_FATALS(InsertTestRows(client_table_.get(), FLAGS_test_scan_num_rows)); - { - // Revert the latency injection flags at the end so the test exits faster. - google::FlagSaver saver; + for (int i = 0; i < cluster_->num_tablet_servers(); ++i) { + MiniTabletServer* ts = cluster_->mini_tablet_server(i); + ts->Shutdown(); + } - // Restart, but inject latency so that startup is very slow. - FLAGS_log_inject_latency = true; - FLAGS_log_inject_latency_ms_mean = 5000; - FLAGS_log_inject_latency_ms_stddev = 0; - for (int i = 0; i < cluster_->num_tablet_servers(); i++) { - MiniTabletServer* ts = cluster_->mini_tablet_server(i); - ts->Shutdown(); - ASSERT_OK(ts->Restart()); - } + // Revert the latency injection flags at the end so the test exits faster. + google::FlagSaver saver; - // As the tservers are still starting up, the scan will retry until it - // times out. The actual error should be embedded in the returned status. - KuduScanner scan(client_table_.get()); - ASSERT_OK(scan.SetTimeoutMillis(1000)); - Status s = scan.Open(); - SCOPED_TRACE(s.ToString()); - ASSERT_TRUE(s.IsTimedOut()); - ASSERT_STR_CONTAINS(s.ToString(), "Illegal state: Tablet not RUNNING"); + // Restart, but inject latency so that startup is very slow. + FLAGS_log_inject_latency = true; + FLAGS_log_inject_latency_ms_mean = 3000; + FLAGS_log_inject_latency_ms_stddev = 0; + + for (int i = 0; i < cluster_->num_tablet_servers(); ++i) { + MiniTabletServer* ts = cluster_->mini_tablet_server(i); + ASSERT_OK(ts->Restart()); } + + // As the tservers are still starting up, the scan will retry until it + // times out. The actual error should be embedded in the returned status. + KuduScanner scan(client_table_.get()); + ASSERT_OK(scan.SetTimeoutMillis(1000)); + Status s = scan.Open(); + ASSERT_TRUE(s.IsTimedOut()) << s.ToString(); + ASSERT_STR_CONTAINS(s.ToString(), "Illegal state: Tablet not RUNNING"); } TEST_F(ClientTest, TestNoDefaultPartitioning) {
