This is an automated email from the ASF dual-hosted git repository.
lta pushed a commit to branch cluster_read
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/cluster_read by this push:
new 7505854 add init router when tear down in router test
7505854 is described below
commit 75058543abdd0e561abe7c045709a82796486648
Author: lta <[email protected]>
AuthorDate: Thu Apr 25 16:22:17 2019 +0800
add init router when tear down in router test
---
.../main/java/org/apache/iotdb/cluster/utils/hash/Router.java | 1 +
.../org/apache/iotdb/cluster/config/ClusterDescriptorTest.java | 9 ++++++---
.../java/org/apache/iotdb/cluster/utils/hash/RouterTest.java | 3 +++
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git
a/cluster/src/main/java/org/apache/iotdb/cluster/utils/hash/Router.java
b/cluster/src/main/java/org/apache/iotdb/cluster/utils/hash/Router.java
index 12d3b01..544c0fc 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/hash/Router.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/hash/Router.java
@@ -189,6 +189,7 @@ public class Router {
sgRouter.clear();
dataPartitionCache.clear();
nodeMapGroupIdCache.clear();
+ groupIdMapNodeCache.clear();
}
@OnlyForTest
diff --git
a/cluster/src/test/java/org/apache/iotdb/cluster/config/ClusterDescriptorTest.java
b/cluster/src/test/java/org/apache/iotdb/cluster/config/ClusterDescriptorTest.java
index d3b1fe2..a03ee99 100644
---
a/cluster/src/test/java/org/apache/iotdb/cluster/config/ClusterDescriptorTest.java
+++
b/cluster/src/test/java/org/apache/iotdb/cluster/config/ClusterDescriptorTest.java
@@ -78,7 +78,6 @@ public class ClusterDescriptorTest {
private int testMetadataConsistencyOld;
private int testDataConsistencyOld;
private int testConcurrentQPTaskThreadOld;
- private int testConcurrentRaftTaskThreadOld;
private Map<String, String> testConfigMap = new HashMap<String, String>() {
private static final long serialVersionUID = 7832408957178621132L;
@@ -121,6 +120,7 @@ public class ClusterDescriptorTest {
@Test
public void test() throws IOException {
+ String oldConfig = System.getProperty(IoTDBConstant.IOTDB_CONF);
System.setProperty(IoTDBConstant.IOTDB_CONF, absoultePath);
ClusterDescriptor.getInstance().loadProps();
ClusterConfig config = ClusterDescriptor.getInstance().getConfig();
@@ -149,8 +149,11 @@ public class ClusterDescriptorTest {
assertEquals(testDataConsistencyNew, config.getReadDataConsistencyLevel()
+ "");
assertEquals(testConcurrentQPTaskThreadNew,
config.getConcurrentQPSubTaskThread() + "");
-
- System.clearProperty(IoTDBConstant.IOTDB_CONF);
+ if (oldConfig == null) {
+ System.clearProperty(IoTDBConstant.IOTDB_CONF);
+ } else {
+ System.setProperty(IoTDBConstant.IOTDB_CONF, oldConfig);
+ }
config.deleteAllPath();
}
diff --git
a/cluster/src/test/java/org/apache/iotdb/cluster/utils/hash/RouterTest.java
b/cluster/src/test/java/org/apache/iotdb/cluster/utils/hash/RouterTest.java
index e88460c..f59bb35 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/utils/hash/RouterTest.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/utils/hash/RouterTest.java
@@ -22,6 +22,8 @@ import static org.junit.Assert.*;
import org.apache.iotdb.cluster.config.ClusterConfig;
import org.apache.iotdb.cluster.config.ClusterDescriptor;
+import org.apache.iotdb.cluster.utils.hash.PhysicalNode;
+import org.apache.iotdb.cluster.utils.hash.Router;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -47,6 +49,7 @@ public class RouterTest {
config.setNodes(ipListOld);
config.setReplication(replicatorOld);
config.setNumOfVirtualNodes(numOfVirtualNodesOld);
+ Router.getInstance().init();
}
@Test