Skip to content

Commit 101e15b

Browse files
authored
KAFKA-18867 add tests to describe topic configs with empty name (apache#19075)
Reviewers: TengYao Chi <[email protected]>, Chia-Ping Tsai <[email protected]>
1 parent d518176 commit 101e15b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,17 +1624,19 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
16241624
client = createAdminClient
16251625

16261626
val existingTopic = new ConfigResource(ConfigResource.Type.TOPIC, topic)
1627-
client.describeConfigs(Collections.singletonList(existingTopic)).values.get(existingTopic).get()
1627+
client.describeConfigs(util.List.of(existingTopic)).values.get(existingTopic).get()
16281628

1629-
val nonExistentTopic = new ConfigResource(ConfigResource.Type.TOPIC, "unknown")
1630-
val describeResult1 = client.describeConfigs(Collections.singletonList(nonExistentTopic))
1629+
val defaultTopic = new ConfigResource(ConfigResource.Type.TOPIC, "")
1630+
var describeResult = client.describeConfigs(util.List.of(defaultTopic))
1631+
assertFutureThrows(classOf[InvalidTopicException], describeResult.all())
16311632

1632-
assertTrue(assertThrows(classOf[ExecutionException], () => describeResult1.values.get(nonExistentTopic).get).getCause.isInstanceOf[UnknownTopicOrPartitionException])
1633+
val nonExistentTopic = new ConfigResource(ConfigResource.Type.TOPIC, "unknown")
1634+
describeResult = client.describeConfigs(util.List.of(nonExistentTopic))
1635+
assertFutureThrows(classOf[UnknownTopicOrPartitionException], describeResult.all())
16331636

16341637
val invalidTopic = new ConfigResource(ConfigResource.Type.TOPIC, "(invalid topic)")
1635-
val describeResult2 = client.describeConfigs(Collections.singletonList(invalidTopic))
1636-
1637-
assertTrue(assertThrows(classOf[ExecutionException], () => describeResult2.values.get(invalidTopic).get).getCause.isInstanceOf[InvalidTopicException])
1638+
describeResult = client.describeConfigs(util.List.of(invalidTopic))
1639+
assertFutureThrows(classOf[InvalidTopicException], describeResult.all())
16381640
}
16391641

16401642
@Test

0 commit comments

Comments
 (0)