kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maniku...@apache.org
Subject [kafka] branch trunk updated: MINOR: Add try/finally blocks to close adminclient in DelegationTokenEndToEndAuthorizationTest (#5861)
Date Thu, 01 Nov 2018 05:12:18 GMT
This is an automated email from the ASF dual-hosted git repository.

manikumar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b2c67e4  MINOR: Add try/finally blocks to close adminclient in DelegationTokenEndToEndAuthorizationTest
(#5861)
b2c67e4 is described below

commit b2c67e4b9a01a1183cefa913da006c3e0d99387b
Author: Manikumar Reddy O <manikumar.reddy@gmail.com>
AuthorDate: Thu Nov 1 10:41:59 2018 +0530

    MINOR: Add try/finally blocks to close adminclient in DelegationTokenEndToEndAuthorizationTest
(#5861)
---
 .../api/DelegationTokenEndToEndAuthorizationTest.scala   | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationTest.scala
b/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationTest.scala
index 62cc97b..2ab2b1a 100644
--- a/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationTest.scala
+++ b/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationTest.scala
@@ -83,12 +83,14 @@ class DelegationTokenEndToEndAuthorizationTest extends EndToEndAuthorizationTest
     config.put(SaslConfigs.SASL_JAAS_CONFIG, clientLoginContext)
 
     val adminClient = AdminClient.create(config)
-    val token = adminClient.createDelegationToken().delegationToken().get()
-    //wait for token to reach all the brokers
-    TestUtils.waitUntilTrue(() => servers.forall(server => !server.tokenCache.tokens().isEmpty),
-      "Timed out waiting for token to propagate to all servers")
-    adminClient.close()
-
-    token
+    try {
+      val token = adminClient.createDelegationToken().delegationToken().get()
+      //wait for token to reach all the brokers
+      TestUtils.waitUntilTrue(() => servers.forall(server => !server.tokenCache.tokens().isEmpty),
+        "Timed out waiting for token to propagate to all servers")
+      token
+    } finally {
+      adminClient.close()
+    }
   }
 }


Mime
View raw message