Repository: kudu
Updated Branches:
refs/heads/master 854658377 -> f5e0024e0
[authn_token_expire-itest] minor clean-up
This patch contains a couple of updates on authn_token_expire-itest:
* Increase authn token's TTL from 2 to 5 seconds in workload-related
test scenario to make it more stable when running with other
parallel activity.
* Do not call ExternalMiniCluster::Start() for slow scenarios
to avoid wasting time if KUDU_ALLOW_SLOW_TESTS is not enabled.
* More relevant names for tests classes.
Change-Id: I437f2f72762c3a6e037792a511259734c8b0d860
Reviewed-on: http://gerrit.cloudera.org:8080/6987
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/f5e0024e
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/f5e0024e
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/f5e0024e
Branch: refs/heads/master
Commit: f5e0024e07645841fafabb8eae8351872516e79d
Parents: 8546583
Author: Alexey Serbin <[email protected]>
Authored: Wed May 24 17:13:05 2017 -0700
Committer: Alexey Serbin <[email protected]>
Committed: Wed May 31 01:25:18 2017 +0000
----------------------------------------------------------------------
.../authn_token_expire-itest.cc | 49 ++++++++++++++------
1 file changed, 36 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/f5e0024e/src/kudu/integration-tests/authn_token_expire-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/authn_token_expire-itest.cc
b/src/kudu/integration-tests/authn_token_expire-itest.cc
index d82cf12..cf42852 100644
--- a/src/kudu/integration-tests/authn_token_expire-itest.cc
+++ b/src/kudu/integration-tests/authn_token_expire-itest.cc
@@ -111,7 +111,6 @@ class AuthnTokenExpireITestBase : public KuduTest {
void SetUp() override {
KuduTest::SetUp();
cluster_.reset(new ExternalMiniCluster(cluster_opts_));
- ASSERT_OK(cluster_->Start());
}
void TearDown() override {
@@ -132,8 +131,8 @@ class AuthnTokenExpireITestBase : public KuduTest {
class AuthnTokenExpireITest : public AuthnTokenExpireITestBase {
public:
- AuthnTokenExpireITest()
- : AuthnTokenExpireITestBase(3, 2) {
+ explicit AuthnTokenExpireITest(int64_t token_validity_seconds = 2)
+ : AuthnTokenExpireITestBase(3, token_validity_seconds) {
// Masters and tservers inject FATAL_INVALID_AUTHENTICATION_TOKEN errors.
// The client should retry the operation again and eventually it should
// succeed even with the high ratio of injected errors.
@@ -158,6 +157,7 @@ class AuthnTokenExpireITest : public
AuthnTokenExpireITestBase {
void SetUp() override {
AuthnTokenExpireITestBase::SetUp();
+ ASSERT_OK(cluster_->Start());
}
};
@@ -221,9 +221,27 @@ TEST_F(AuthnTokenExpireITest, RestartCluster) {
num_tablet_servers_, num_tablet_servers_ * 2));
}
-// Run the workload and check that client retries INVALID_AUTH_TOKEN errors,
+class AuthnTokenExpireDuringWorkloadITest : public AuthnTokenExpireITest {
+ public:
+ AuthnTokenExpireDuringWorkloadITest()
+ : AuthnTokenExpireITest(5) {
+ // Close an already established idle connection to the server and open
+ // a new one upon making another call to the same server. This is to force
+ // authn token verification at every RPC.
+ FLAGS_rpc_reopen_outbound_connections = true;
+ }
+
+ void SetUp() override {
+ AuthnTokenExpireITestBase::SetUp();
+ // Do not start the cluster as a part of setup phase. Don't waste time on
+ // on that because the scenario contains a test which is marked slow and
+ // will be skipped if KUDU_ALLOW_SLOW_TESTS environment variable is not
set.
+ }
+};
+
+// Run the workload and check that client retries on ERROR_INVALID_AUTH_TOKEN,
// eventually succeeding with its RPCs.
-TEST_F(AuthnTokenExpireITest, InvalidTokenDuringWorkload) {
+TEST_F(AuthnTokenExpireDuringWorkloadITest, TokenExpiration) {
static const int32_t kTimeoutMs = 10 * 60 * 1000;
if (!AllowSlowTests()) {
@@ -231,10 +249,7 @@ TEST_F(AuthnTokenExpireITest, InvalidTokenDuringWorkload) {
return;
}
- // Close an already established idle connection to the server and open
- // a new one upon making another call to the same server. This is to force
- // authn token verification at every RPC.
- FLAGS_rpc_reopen_outbound_connections = true;
+ ASSERT_OK(cluster_->Start());
TestWorkload w(cluster_.get());
w.set_client_default_admin_operation_timeout_millis(kTimeoutMs);
@@ -261,9 +276,12 @@ TEST_F(AuthnTokenExpireITest, InvalidTokenDuringWorkload) {
NO_FATALS(cluster_->AssertNoCrashes());
}
-class AuthnTokenReacquireITest : public AuthnTokenExpireITestBase {
+// Scenarios to verify that the client automatically re-acquires authn token
+// when receiving ERROR_INVALID_AUTHENTICATION_TOKEN from the servers in case
+// if the client has established a token-based connection to master server.
+class TokenBasedConnectionITest : public AuthnTokenExpireITestBase {
public:
- AuthnTokenReacquireITest()
+ TokenBasedConnectionITest()
: AuthnTokenExpireITestBase(3, 2) {
cluster_opts_.extra_master_flags = {
@@ -275,14 +293,19 @@ class AuthnTokenReacquireITest : public
AuthnTokenExpireITestBase {
"--heartbeat_interval_ms=10",
};
}
+
+ void SetUp() override {
+ AuthnTokenExpireITestBase::SetUp();
+ ASSERT_OK(cluster_->Start());
+ }
};
// This test verifies that the token re-acquire logic behaves correctly in case
// if the connection to the master is established using previously acquired
// authn token. The master has particular constraint to prohibit re-issuing
// a new authn token over a connection established with authn token itself
-// (otherwise, a authn token would never effectively expire).
-TEST_F(AuthnTokenReacquireITest, ConnectionToMasterViaAuthnToken) {
+// (otherwise, an authn token would never effectively expire).
+TEST_F(TokenBasedConnectionITest, ReacquireAuthnToken) {
const string table_name = "authn-token-reacquire";
// Create a client and perform some basic operations to acquire authn token.