kgusakov commented on code in PR #4675:
URL: https://github.com/apache/ignite-3/pull/4675#discussion_r1837062656


##########
modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/configuration/DistributionZonesHighAvailabilityConfigurationTest.java:
##########
@@ -50,28 +57,53 @@ 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();
+
+        assertNotEquals(10, partitionDistributionResetTimeoutValue.get());
+        assertNotEquals(1, revisionValue.get());
+
+        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
+            String partitionDistributionReset
     ) {
         CompletableFuture<Void> changeFuture = systemConfig.change(c0 -> 
c0.changeProperties()
-                .create(PARTITION_DISTRIBUTION_RESET_TIMEOUT, c1 -> 
c1.changePropertyValue(partitionDistributionResetScaleDown))
+                .create(PARTITION_DISTRIBUTION_RESET_TIMEOUT, c1 -> 
c1.changePropertyValue(partitionDistributionReset))
         );
 
         assertThat(changeFuture, willCompleteSuccessfully());

Review Comment:
   Added a little bit complex, but fair test 
https://github.com/apache/ignite-3/pull/4675/files#diff-5ab45555a009f971ccc56ab5a8e0946fc2225742ae3a1434e31e2597505bb649R526
 - I think we can simplify it, when we will have real reactions, now I can test 
only the scheduling behavior itself.



-- 
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

Reply via email to