MINOR: Add try/finally blocks to close adminclient in DelegationTokenEndToEndAuthorizationTest
@@ -83,12 +83,14 @@ class DelegationTokenEndToEndAuthorizationTest extends EndToEndAuthorizationTest
config.put(SaslConfigs.SASL_JAAS_CONFIG, clientLoginContext)
val adminClient = AdminClient.create(config)
+ 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")
- adminClient.close()
-
token
+ } finally {
+ adminClient.close()
+ }
}
}
