funky-eyes commented on code in PR #6004:
URL: https://github.com/apache/incubator-seata/pull/6004#discussion_r1441545616


##########
core/src/test/java/io/seata/core/rpc/netty/RmNettyClientTest.java:
##########
@@ -47,6 +78,24 @@ public void assertGetInstanceAfterDestroy() {
         assertTrue(initialized.get());
         newClient.destroy();
     }
+
+    @Test
+    public void testCheckFailFast() throws Exception {
+        RmNettyRemotingClient newClient = 
RmNettyRemotingClient.getInstance("fail_fast", "default_tx_group");
+
+        ResourceManager resourceManager = Mockito.mock(ResourceManager.class);
+        Resource mockResource = Mockito.mock(Resource.class);
+        Map<String, Resource> resourceMap = new HashMap<>();
+        resourceMap.put("jdbc:xx://localhost/test", mockResource);
+        
Mockito.when(resourceManager.getManagedResources()).thenReturn(resourceMap);
+        newClient.setResourceManager(resourceManager);
+        System.setProperty("file.listener.enabled", "true");
+        
ConfigurationCache.addConfigListener(ConfigurationKeys.ENABLE_RM_CLIENT_CHANNEL_CHECK_FAIL_FAST,
+            event -> logger.info("dataId:{}, value: {}, oldValue: {}", 
event.getDataId(), event.getNewValue(),
+                event.getOldValue()));
+        
System.setProperty(ConfigurationKeys.ENABLE_RM_CLIENT_CHANNEL_CHECK_FAIL_FAST, 
"true");
+        Assertions.assertThrows(FrameworkException.class, newClient::init);

Review Comment:
   ```suggestion
           Thread.sleep(2000);
           Assertions.assertThrows(FrameworkException.class, newClient::init);
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to