unknowntpo commented on code in PR #16687: URL: https://github.com/apache/kafka/pull/16687#discussion_r1712922948
########## core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala: ########## @@ -95,6 +96,35 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { super.tearDown() } + @ParameterizedTest + @ValueSource(strings = Array("zk", "kraft")) + def testCreatePartitionWithOptionRetryOnQuotaViolation(): Unit = { + // Since it's hard to stably reach quota limit in integration test, we only verify quota configs are set correctly + val config = createConfig + val clientId = "test-client-id" + + config.put(AdminClientConfig.CLIENT_ID_CONFIG, clientId) + client = AdminClientTestUtils.create(config, null) + + val entity = new ClientQuotaEntity(Map(ClientQuotaEntity.CLIENT_ID -> clientId).asJava) + + val configEntries = Map(QuotaConfigs.CONTROLLER_MUTATION_RATE_OVERRIDE_CONFIG -> 1.0, QuotaConfigs.CONSUMER_BYTE_RATE_OVERRIDE_CONFIG -> 3.0) + val quotas = configEntries.map {case (k, v) => new ClientQuotaAlteration.Op(k,v)} + val alterResult = client.alterClientQuotas(Seq(new ClientQuotaAlteration(entity, quotas.asJavaCollection)).asJavaCollection) + alterResult.all.get + + TestUtils.waitUntilTrue(() => { + // wait for our ClientQuotaEntity to be set + client.describeClientQuotas(ClientQuotaFilter.all()).entities().get().size == 1 + }, + "Timed out waiting for quota config to be propagated to all servers") + + val describeResult = client.describeClientQuotas(ClientQuotaFilter.all()) + val quotaEntities = describeResult.entities().get() + assertTrue(quotaEntities.containsKey(entity)) + assertEquals(configEntries,quotaEntities.get(entity).asScala) Review Comment: Seems assertTrue() is redundant. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org