Skip to content

Commit 5b349f0

Browse files
committed
Remove useless cluster mode check when using DistSQLExecutorClusterModeRequired
1 parent f9eeef4 commit 5b349f0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeOnlineHandlerTest.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.mockito.junit.jupiter.MockitoExtension;
3434

3535
import static org.mockito.ArgumentMatchers.any;
36-
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
3736
import static org.mockito.Mockito.mock;
3837
import static org.mockito.Mockito.times;
3938
import static org.mockito.Mockito.verify;
@@ -47,10 +46,14 @@ class ComputeNodeOnlineHandlerTest {
4746
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
4847
private ContextManager contextManager;
4948

49+
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
50+
private ClusterPersistServiceFacade clusterPersistServiceFacade;
51+
5052
@BeforeEach
5153
void setUp() {
5254
handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream()
5355
.filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/nodes/compute_nodes/online")).findFirst().orElse(null);
56+
when(contextManager.getPersistServiceFacade().getModeFacade()).thenReturn(clusterPersistServiceFacade);
5457
}
5558

5659
@Test
@@ -62,9 +65,7 @@ void assertHandleWithInvalidInstanceOnlinePath() {
6265
@Test
6366
void assertHandleWithInstanceOnlineEvent() {
6467
ComputeNodeInstance computeNodeInstance = mock(ComputeNodeInstance.class);
65-
ClusterPersistServiceFacade clusterPersistServiceFacade = mock(ClusterPersistServiceFacade.class, RETURNS_DEEP_STUBS);
6668
when(clusterPersistServiceFacade.getComputeNodeService().loadInstance(any())).thenReturn(computeNodeInstance);
67-
when(contextManager.getPersistServiceFacade().getModeFacade()).thenReturn(clusterPersistServiceFacade);
6869
handler.handle(contextManager, new DataChangedEvent("/nodes/compute_nodes/online/proxy/foo_instance_id", "{attribute: 127.0.0.1@3307,version: 1}", Type.ADDED));
6970
verify(contextManager.getComputeNodeInstanceContext().getClusterInstanceRegistry()).add(computeNodeInstance);
7071
}

0 commit comments

Comments
 (0)