gaurav-narula commented on code in PR #23797:
URL: https://github.com/apache/kafka/pull/23797#discussion_r4261762190
##########
server/src/test/java/org/apache/kafka/server/config/DynamicBrokerConfigTest.java:
##########
@@ -79,4 +86,37 @@ public void testBrokerConfigSynonyms() {
assertEquals(List.of("anything"),
DynamicBrokerConfig.brokerConfigSynonyms("anything", false));
}
+
+ @Test
+ public void testDynamicClusterMirrorConfigReconfigurableConfigs() {
+ assertTrue(DynamicClusterMirrorConfig.RECONFIGURABLE_CONFIGS.contains(
+ ClusterMirrorConfigs.MIRROR_NUM_REPLICA_FETCHERS_CONFIG));
+ assertTrue(DynamicClusterMirrorConfig.RECONFIGURABLE_CONFIGS.contains(
+
ClusterMirrorConfigs.MIRROR_METADATA_REFRESH_INTERVAL_MS_CONFIG));
+ }
+
+ @Test
+ public void testDynamicClusterMirrorConfigValidation() {
+ AbstractKafkaConfig currentConfig = mockConfig(4, 60000L);
+ DynamicClusterMirrorConfig dynamicConfig = new
DynamicClusterMirrorConfig(() -> currentConfig);
+
+ assertDoesNotThrow(() ->
dynamicConfig.validateReconfiguration(mockConfig(6, 60000L)));
+
+ ConfigException err1 = assertThrows(ConfigException.class,
+ () -> dynamicConfig.validateReconfiguration(mockConfig(1,
60000L)));
+ assertTrue(err1.getMessage().contains("Value should be at least half
the current value 4"));
+
+ ConfigException err2 = assertThrows(ConfigException.class,
+ () -> dynamicConfig.validateReconfiguration(mockConfig(9,
60000L)));
+ assertTrue(err2.getMessage().contains("Value should not be greater
than double the current value 4"));
+
+ assertDoesNotThrow(() ->
dynamicConfig.validateReconfiguration(mockConfig(4, 0L)));
+ }
+
+ private static AbstractKafkaConfig mockConfig(int fetchers, long
intervalMs) {
+ AbstractKafkaConfig config = mock(AbstractKafkaConfig.class);
+
when(config.getInt(ClusterMirrorConfigs.MIRROR_NUM_REPLICA_FETCHERS_CONFIG)).thenReturn(fetchers);
+
when(config.getLong(ClusterMirrorConfigs.MIRROR_METADATA_REFRESH_INTERVAL_MS_CONFIG)).thenReturn(intervalMs);
Review Comment:
I think this can be avoided as
`DynamicClusterMirrorConfig#validateReconfiguration` does not use it?
--
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]