You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/07/14 16:41:26 UTC

[shardingsphere] branch master updated: Complete test #18772 (#19130)

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 86b9b3c9a38 Complete  test #18772 (#19130)
86b9b3c9a38 is described below

commit 86b9b3c9a3887fcb06fdb311d006b75ca24fa008
Author: skai <su...@gmail.com>
AuthorDate: Fri Jul 15 00:41:18 2022 +0800

    Complete  test #18772 (#19130)
    
    * Complete  test
    
    * fix whitespace
    
    * Update ComputeNodeStatusServiceTest.java
    
    Co-authored-by: skai <sk...@topode.com>
---
 .../status/compute/service/ComputeNodeStatusServiceTest.java     | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServi [...]
index d08b616363b..f926dec56e7 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java
@@ -19,7 +19,9 @@ package org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.stat
 
 import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
 import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
 import org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
+import org.apache.shardingsphere.infra.instance.utils.IpUtils;
 import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
 import org.apache.shardingsphere.mode.metadata.persist.node.ComputeNode;
 import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
@@ -103,7 +105,12 @@ public final class ComputeNodeStatusServiceTest {
         when(repository.get("/nodes/compute_nodes/online/proxy/foo_instance_3308")).thenReturn("127.0.0.1@3308");
         List<ComputeNodeInstance> actual = new ArrayList<>(new ComputeNodeStatusService(repository).loadAllComputeNodeInstances());
         assertThat(actual.size(), is(2));
-        // TODO assert more
+        assertThat(actual.get(0).getInstanceMetaData().getId(), is("foo_instance_3307"));
+        assertThat(actual.get(0).getInstanceMetaData().getIp(), is(IpUtils.getIp()));
+        assertThat(actual.get(1).getInstanceMetaData().getId(), is("foo_instance_3308"));
+        assertThat(actual.get(1).getInstanceMetaData().getIp(), is("127.0.0.1"));
+        assertThat(actual.get(1).getInstanceMetaData().getType(), is(InstanceType.PROXY));
+        assertThat(((ProxyInstanceMetaData) actual.get(1).getInstanceMetaData()).getPort(), is(3308));
     }
     
     @Test