Fix TestKerberosRenewal/Reacquire flakiness

It has been observed that an ExternalMiniCluster can take quite
long to start up (max observerd: 6s). TestKerberosRenewal/Reacquire ran
with the kerberos ticket lifetime as 5 seconds. If the ExternalMiniCluster
took longer than 5 seconds to start, the ticket of the test client would
expire, causing an unexpected test failure.

This patch increases the ticket lifetime to 15s. This will increase the
test time, but reduces the chance for flakiness.

Change-Id: If03a2b47e78a22736311e8dd160ddf63b86c4396
Reviewed-on: http://gerrit.cloudera.org:8080/6168
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/50274c8f
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/50274c8f
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/50274c8f

Branch: refs/heads/master
Commit: 50274c8f8bc4da19323694be8793612942002509
Parents: 2730f8b
Author: Sailesh Mukil <[email protected]>
Authored: Mon Feb 27 13:13:57 2017 -0800
Committer: Todd Lipcon <[email protected]>
Committed: Tue Feb 28 06:19:46 2017 +0000

----------------------------------------------------------------------
 .../integration-tests/external_mini_cluster-test.cc  | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/50274c8f/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
index b73343f..5b3405c 100644
--- a/src/kudu/integration-tests/external_mini_cluster-test.cc
+++ b/src/kudu/integration-tests/external_mini_cluster-test.cc
@@ -59,9 +59,10 @@ void SmokeTestKerberizedCluster(const 
ExternalMiniClusterOptions& opts) {
 
   // 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(10));
+  SleepFor(MonoDelta::FromSeconds(16));
 
-  // Re-kinit for the client, since the client's ticket would have expired as 
well.
+  // 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
@@ -74,22 +75,26 @@ void SmokeTestKerberizedCluster(const 
ExternalMiniClusterOptions& opts) {
 }
 
 TEST_F(ExternalMiniClusterTest, TestKerberosRenewal) {
+  if (!AllowSlowTests()) return;
+
   ExternalMiniClusterOptions opts;
   opts.enable_kerberos = true;
   // Set the kerberos ticket lifetime as 5 seconds to force ticket renewal 
every 5 seconds.
-  opts.mini_kdc_options.ticket_lifetime = "5s";
+  opts.mini_kdc_options.ticket_lifetime = "15s";
   opts.num_tablet_servers = 1;
 
   SmokeTestKerberizedCluster(opts);
 }
 
 TEST_F(ExternalMiniClusterTest, TestKerberosReacquire) {
+  if (!AllowSlowTests()) return;
+
   ExternalMiniClusterOptions opts;
   opts.enable_kerberos = true;
   // Set the kerberos ticket lifetime and the renew lifetime as 5 seconds 
each, to force the
   // processes to acquire a new ticket instead of being able to renew the 
existing one.
-  opts.mini_kdc_options.ticket_lifetime = "5s";
-  opts.mini_kdc_options.renew_lifetime = "5s";
+  opts.mini_kdc_options.ticket_lifetime = "15s";
+  opts.mini_kdc_options.renew_lifetime = "15s";
   opts.num_tablet_servers = 1;
 
   SmokeTestKerberizedCluster(opts);

Reply via email to