This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 411a98a4e67 Refactor ShowComputeNodesExecutorTest (#37562)
411a98a4e67 is described below
commit 411a98a4e677eb3b85621bfa02fb89377b999f64
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Dec 28 20:43:54 2025 +0800
Refactor ShowComputeNodesExecutorTest (#37562)
---
.../ral/queryable/computenode/ShowComputeNodesExecutorTest.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutorTest.java
index 91f6b9b2938..2b926fc0169 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutorTest.java
@@ -26,8 +26,9 @@ import
org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext;
import
org.apache.shardingsphere.infra.instance.metadata.jdbc.JDBCInstanceMetaData;
import
org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import org.apache.shardingsphere.infra.state.instance.InstanceStateContext;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.infra.state.instance.InstanceStateContext;
+import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
import
org.apache.shardingsphere.mode.manager.cluster.persist.facade.ClusterPersistServiceFacade;
import
org.apache.shardingsphere.mode.manager.standalone.persist.facade.StandalonePersistServiceFacade;
@@ -126,12 +127,11 @@ class ShowComputeNodesExecutorTest {
@Test
void assertExecuteWithJdbcInstance() {
ContextManager contextManager = mock(ContextManager.class,
RETURNS_DEEP_STUBS);
- ComputeNodeInstanceContext computeNodeInstanceContext =
mock(ComputeNodeInstanceContext.class, RETURNS_DEEP_STUBS);
- when(computeNodeInstanceContext.getModeConfiguration()).thenReturn(new
ModeConfiguration("Cluster", mock(PersistRepositoryConfiguration.class)));
-
when(contextManager.getComputeNodeInstanceContext()).thenReturn(computeNodeInstanceContext);
ComputeNodeInstance computeNodeInstance = new ComputeNodeInstance(new
JDBCInstanceMetaData("jdbc_instance", "192.168.0.1", "jdbc_version",
"logic_db"));
computeNodeInstance.setWorkerId(2);
computeNodeInstance.getLabels().add("prod");
+ ComputeNodeInstanceContext computeNodeInstanceContext = new
ComputeNodeInstanceContext(computeNodeInstance, new
ModeConfiguration("Cluster", mock()), new EventBusContext());
+
when(contextManager.getComputeNodeInstanceContext()).thenReturn(computeNodeInstanceContext);
when(contextManager.getPersistServiceFacade().getModeFacade().getComputeNodeService().loadAllInstances()).thenReturn(Collections.singleton(computeNodeInstance));
Collection<LocalDataQueryResultRow> actual =
executor.getRows(mock(ShowComputeNodesStatement.class), contextManager);
LocalDataQueryResultRow row = actual.iterator().next();