kgusakov commented on code in PR #4675: URL: https://github.com/apache/ignite-3/pull/4675#discussion_r1836491696
########## modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/configuration/DistributionZonesHighAvailabilityConfigurationTest.java: ########## @@ -50,22 +56,44 @@ void testValidSystemPropertiesOnStart( + PARTITION_DISTRIBUTION_RESET_TIMEOUT + ".propertyValue = \"5\"}") SystemDistributedConfiguration systemConfig ) { - var config = new DistributionZonesHighAvailabilityConfiguration(systemConfig); + var config = new DistributionZonesHighAvailabilityConfiguration(systemConfig, noOpConsumer); config.startAndInit(); assertEquals(5, config.partitionDistributionResetTimeout()); } @Test void testValidSystemPropertiesOnChange(@InjectConfiguration SystemDistributedConfiguration systemConfig) { - var config = new DistributionZonesHighAvailabilityConfiguration(systemConfig); + var config = new DistributionZonesHighAvailabilityConfiguration(systemConfig, noOpConsumer); config.startAndInit(); changeSystemConfig(systemConfig, "10"); assertEquals(10, config.partitionDistributionResetTimeout()); } + @Test + void testUpdateConfigListener(@InjectConfiguration SystemDistributedConfiguration systemConfig) throws InterruptedException { + AtomicReference<Integer> partitionDistributionResetTimeoutValue = new AtomicReference<>(); + AtomicReference<Long> revisionValue = new AtomicReference<>(); + + var config = new DistributionZonesHighAvailabilityConfiguration( + systemConfig, + (partitionDistributionResetTimeout, revision) -> { + partitionDistributionResetTimeoutValue.set(partitionDistributionResetTimeout); + revisionValue.set(revision); + } + ); + config.startAndInit(); + + changeSystemConfig(systemConfig, "10"); + + assertTrue(waitForCondition(() -> + partitionDistributionResetTimeoutValue.get() != null + && partitionDistributionResetTimeoutValue.get() == 10, 1_000)); + assertEquals(1, revisionValue.get()); + } + private static void changeSystemConfig( SystemDistributedConfiguration systemConfig, String partitionDistributionResetScaleDown Review Comment: fixed ########## modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/configuration/DistributionZonesHighAvailabilityConfigurationTest.java: ########## @@ -50,22 +56,44 @@ void testValidSystemPropertiesOnStart( + PARTITION_DISTRIBUTION_RESET_TIMEOUT + ".propertyValue = \"5\"}") SystemDistributedConfiguration systemConfig ) { - var config = new DistributionZonesHighAvailabilityConfiguration(systemConfig); + var config = new DistributionZonesHighAvailabilityConfiguration(systemConfig, noOpConsumer); config.startAndInit(); assertEquals(5, config.partitionDistributionResetTimeout()); } @Test void testValidSystemPropertiesOnChange(@InjectConfiguration SystemDistributedConfiguration systemConfig) { - var config = new DistributionZonesHighAvailabilityConfiguration(systemConfig); + var config = new DistributionZonesHighAvailabilityConfiguration(systemConfig, noOpConsumer); config.startAndInit(); changeSystemConfig(systemConfig, "10"); assertEquals(10, config.partitionDistributionResetTimeout()); } + @Test + void testUpdateConfigListener(@InjectConfiguration SystemDistributedConfiguration systemConfig) throws InterruptedException { + AtomicReference<Integer> partitionDistributionResetTimeoutValue = new AtomicReference<>(); + AtomicReference<Long> revisionValue = new AtomicReference<>(); + + var config = new DistributionZonesHighAvailabilityConfiguration( + systemConfig, + (partitionDistributionResetTimeout, revision) -> { + partitionDistributionResetTimeoutValue.set(partitionDistributionResetTimeout); + revisionValue.set(revision); + } + ); + config.startAndInit(); + + changeSystemConfig(systemConfig, "10"); + + assertTrue(waitForCondition(() -> + partitionDistributionResetTimeoutValue.get() != null + && partitionDistributionResetTimeoutValue.get() == 10, 1_000)); Review Comment: added -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org