YongGoose commented on code in PR #7576:
URL: https://github.com/apache/incubator-seata/pull/7576#discussion_r2276182804


##########
config/seata-config-consul/src/test/java/org/apache/seata/config/consul/ConsulConfigurationTest.java:
##########
@@ -131,6 +133,31 @@ void testInitSeataConfig() throws Exception {
         assertEquals("val1", value, "KV should be visible after a short 
await");
     }
 
+    @Test
+    void testOnChangeEvent_skipWhenValueIsBlank() throws InterruptedException {
+
+        String dataId = "seata.properties";
+        ConsulConfiguration.ConsulListener listener = new 
ConsulConfiguration.ConsulListener(dataId, null);
+
+        GetValue blankValue = mock(GetValue.class);
+        when(blankValue.getDecodedValue()).thenReturn("");
+
+        Response<GetValue> blankResponse = new Response<>(blankValue, 2L, 
false, 2L);
+        when(mockConsulClient.getKVValue(eq(dataId), isNull(), 
any(QueryParams.class)))
+                .thenReturn(blankResponse);
+
+        // Run onChangeEvent in a separate thread since it loops indefinitely
+        Thread thread = new Thread(() -> listener.onChangeEvent(new 
ConfigurationChangeEvent()));
+        thread.start();
+        Thread.sleep(100);
+        // Interrupt to break the loop
+        thread.interrupt();
+        thread.join(500);

Review Comment:
   I also see `return` statements in other configuration code.
   And please don’t close the conversation while it’s still ongoing.



-- 
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...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to