You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2023/12/08 07:23:14 UTC
(kafka) branch trunk updated: MINOR: Avoid leaking threads in DelegationTokenEndToEndAuthorizationWithOwnerTest.testDescribeTokenForOtherUserFails (#14959)
This is an automated email from the ASF dual-hosted git repository.
dajac 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 38c873b80f7 MINOR: Avoid leaking threads in DelegationTokenEndToEndAuthorizationWithOwnerTest.testDescribeTokenForOtherUserFails (#14959)
38c873b80f7 is described below
commit 38c873b80f7c8f16d8a6a41e0da4f96b6ab8f42d
Author: David Jacot <dj...@confluent.io>
AuthorDate: Fri Dec 8 08:23:08 2023 +0100
MINOR: Avoid leaking threads in DelegationTokenEndToEndAuthorizationWithOwnerTest.testDescribeTokenForOtherUserFails (#14959)
Reviewers: Lucas Brutschy <lb...@confluent.io>
---
...ationTokenEndToEndAuthorizationWithOwnerTest.scala | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationWithOwnerTest.scala b/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationWithOwnerTest.scala
index 6ea5f8e2887..f6fbd919ccd 100644
--- a/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationWithOwnerTest.scala
+++ b/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationWithOwnerTest.scala
@@ -105,17 +105,14 @@ class DelegationTokenEndToEndAuthorizationWithOwnerTest extends DelegationTokenE
@ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
@ValueSource(strings = Array("kraft", "zk"))
def testDescribeTokenForOtherUserFails(quorum: String): Unit = {
- val describeTokenFailAdminClient = createScramAdminClient(kafkaClientSaslMechanism, describeTokenFailPrincipal.getName, describeTokenFailPassword)
- val otherClientAdminClient = createScramAdminClient(kafkaClientSaslMechanism, otherClientPrincipal.getName, otherClientPassword)
- try {
- otherClientAdminClient.createDelegationToken().delegationToken().get()
- val tokens = describeTokenFailAdminClient.describeDelegationToken(
- new DescribeDelegationTokenOptions().owners(Collections.singletonList(otherClientPrincipal)))
- .delegationTokens.get.asScala
- assertTrue(tokens.isEmpty)
- } finally {
- describeTokenFailAdminClient.close()
- otherClientAdminClient.close()
+ TestUtils.resource(createScramAdminClient(kafkaClientSaslMechanism, describeTokenFailPrincipal.getName, describeTokenFailPassword)) { describeTokenFailAdminClient =>
+ TestUtils.resource(createScramAdminClient(kafkaClientSaslMechanism, otherClientPrincipal.getName, otherClientPassword)) { otherClientAdminClient =>
+ otherClientAdminClient.createDelegationToken().delegationToken().get()
+ val tokens = describeTokenFailAdminClient.describeDelegationToken(
+ new DescribeDelegationTokenOptions().owners(Collections.singletonList(otherClientPrincipal))
+ ).delegationTokens.get.asScala
+ assertTrue(tokens.isEmpty)
+ }
}
}