Skip to content

Commit c5cd190

Browse files
authored
MINOR: Refactor SSL/SASL admin integration tests to not use a custom authorizer (apache#15377)
Reviewers: Mickael Maison <[email protected]>
1 parent 520aa86 commit c5cd190

File tree

5 files changed

+207
-166
lines changed

5 files changed

+207
-166
lines changed

core/src/test/scala/integration/kafka/api/BaseAdminIntegrationTest.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ abstract class BaseAdminIntegrationTest extends IntegrationTestHarness with Logg
7171

7272
@Test
7373
def testCreateDeleteTopics(): Unit = {
74-
client = Admin.create(createConfig)
74+
client = createAdminClient
7575
val topics = Seq("mytopic", "mytopic2", "mytopic3")
7676
val newTopics = Seq(
7777
new NewTopic("mytopic", Map((0: Integer) -> Seq[Integer](1, 2).asJava, (1: Integer) -> Seq[Integer](2, 0).asJava).asJava),
@@ -163,7 +163,7 @@ abstract class BaseAdminIntegrationTest extends IntegrationTestHarness with Logg
163163

164164
@Test
165165
def testAuthorizedOperations(): Unit = {
166-
client = Admin.create(createConfig)
166+
client = createAdminClient
167167

168168
// without includeAuthorizedOperations flag
169169
var result = client.describeCluster
@@ -226,12 +226,17 @@ abstract class BaseAdminIntegrationTest extends IntegrationTestHarness with Logg
226226
val config = new util.HashMap[String, Object]
227227
config.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers())
228228
config.put(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, "20000")
229-
val securityProps: util.Map[Object, Object] =
230-
adminClientSecurityConfigs(securityProtocol, trustStoreFile, clientSaslProperties)
231-
securityProps.forEach { (key, value) => config.put(key.asInstanceOf[String], value) }
229+
config.put(AdminClientConfig.DEFAULT_API_TIMEOUT_MS_CONFIG, "40000")
232230
config
233231
}
234232

233+
def createAdminClient: Admin = {
234+
val props = new Properties()
235+
props.putAll(createConfig)
236+
val client = createAdminClient(configOverrides = props)
237+
client
238+
}
239+
235240
def waitForTopics(client: Admin, expectedPresent: Seq[String], expectedMissing: Seq[String]): Unit = {
236241
waitUntilTrue(() => {
237242
val topics = client.listTopics.names.get()

0 commit comments

Comments
 (0)