gabriellefu commented on code in PR #23355:
URL: https://github.com/apache/kafka/pull/23355#discussion_r3980586981
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AlterConfigsIntegrationTest.java:
##########
@@ -125,14 +201,50 @@ private void checkAlterConfigs(Map<String, Object>
adminConfig, Class<? extends
}
}
- private Collection<AlterConfigOp> configProviderOps() {
+ private void checkAlterConfigsApplied(
+ ConfigResource target,
+ ConfigEntry.ConfigSource expectedSource,
+ String configName,
+ String value
+ ) throws Exception {
+ Files.writeString(file, "key=" + value);
+ ConfigResource brokerResource = brokerResource();
+ try (Admin admin = clusterInstance.admin()) {
+ admin.incrementalAlterConfigs(Map.of(target,
configProviderOps(configName))).all().get();
+ // The broker applies the update asynchronously when it replays
the metadata log. DescribeConfigs is
+ // served from the broker's own config, so the source only changes
once the update took effect.
+ TestUtils.waitForCondition(
+ () -> describeConfig(admin, brokerResource,
configName).source() == expectedSource,
+ configName + " was not applied with source " + expectedSource
+ );
+ assertEquals(value, describeConfig(admin, brokerResource,
configName).value());
+ }
+ }
+
+ private static ConfigEntry describeConfig(Admin admin, ConfigResource
resource, String name) throws Exception {
+ return
admin.describeConfigs(List.of(resource)).all().get().get(resource).get(name);
+ }
+
+ private int brokerId() {
+ return clusterInstance.brokerIds().iterator().next();
+ }
+
+ private ConfigResource brokerResource() {
+ return new ConfigResource(ConfigResource.Type.BROKER,
String.valueOf(brokerId()));
+ }
+
+ private KafkaConfig brokerConfig() {
Review Comment:
sounds good, updated! thanks
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]