diff --git a/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml b/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml index 29242f954e..41b02ac781 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml +++ b/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml @@ -3,7 +3,7 @@ port: 8181 # timeout in ms of gremlin query -scriptEvaluationTimeout: 30000 +scriptEvaluationTimeout: 60000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer # don't set graph at here, this happens after support for dynamically adding graph diff --git a/hugegraph-dist/src/assembly/travis/conf-raft1/rest-server.properties b/hugegraph-dist/src/assembly/travis/conf-raft1/rest-server.properties index 2611b95a2f..25b6b283d3 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft1/rest-server.properties +++ b/hugegraph-dist/src/assembly/travis/conf-raft1/rest-server.properties @@ -9,3 +9,6 @@ rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 server.id=server1 server.role=master + +restserver.request_timeout=60 +gremlinserver.timeout=60 diff --git a/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml b/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml index fcc0c351e4..119763cc4d 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml +++ b/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml @@ -3,7 +3,7 @@ port: 8182 # timeout in ms of gremlin query -scriptEvaluationTimeout: 30000 +scriptEvaluationTimeout: 60000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer # don't set graph at here, this happens after support for dynamically adding graph diff --git a/hugegraph-dist/src/assembly/travis/conf-raft2/rest-server.properties b/hugegraph-dist/src/assembly/travis/conf-raft2/rest-server.properties index cde90ac068..f1eb1b4584 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft2/rest-server.properties +++ b/hugegraph-dist/src/assembly/travis/conf-raft2/rest-server.properties @@ -9,3 +9,6 @@ rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 server.id=server2 server.role=worker + +restserver.request_timeout=60 +gremlinserver.timeout=60 diff --git a/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml b/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml index 218f49964d..9ecfd01fe9 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml +++ b/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml @@ -3,7 +3,7 @@ port: 8183 # timeout in ms of gremlin query -scriptEvaluationTimeout: 30000 +scriptEvaluationTimeout: 60000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer # don't set graph at here, this happens after support for dynamically adding graph diff --git a/hugegraph-dist/src/assembly/travis/conf-raft3/rest-server.properties b/hugegraph-dist/src/assembly/travis/conf-raft3/rest-server.properties index e8e72a3fd3..e31d3d286f 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft3/rest-server.properties +++ b/hugegraph-dist/src/assembly/travis/conf-raft3/rest-server.properties @@ -9,3 +9,6 @@ rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 server.id=server3 server.role=worker + +restserver.request_timeout=60 +gremlinserver.timeout=60 diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/BaseApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/BaseApiTest.java index ac44371254..4531f2bfee 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/BaseApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/BaseApiTest.java @@ -495,10 +495,7 @@ protected static void clearGraph() { String path = URL_PREFIX + urlSuffix; String type = urlSuffix.substring(urlSuffix.lastIndexOf('/') + 1); Response r = client.get(path); - if (r.getStatus() != 200) { - throw new HugeException("Failed to list " + type); - } - String content = r.readEntity(String.class); + String content = assertResponseStatus(200, r); @SuppressWarnings("rawtypes") List list = readList(content, type, Map.class); List ids = list.stream().map(e -> e.get("id")) @@ -517,10 +514,7 @@ protected static void clearSchema() { String path = URL_PREFIX + urlSuffix; String type = urlSuffix.substring(urlSuffix.lastIndexOf('/') + 1); Response r = client.get(path); - if (r.getStatus() != 200) { - throw new HugeException("Failed to list " + type); - } - String content = r.readEntity(String.class); + String content = assertResponseStatus(200, r); @SuppressWarnings("rawtypes") List list = readList(content, type, Map.class); List names = list.stream().map(e -> e.get("name")) diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/TaskApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/TaskApiTest.java index 8884e5b242..50b2812844 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/TaskApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/TaskApiTest.java @@ -52,10 +52,17 @@ public void testList() { assertArrayContains(tasks, "id", taskId); waitTaskSuccess(taskId); + /* + * FIXME: sometimes may get results of RUNNING tasks after the task + * status is SUCCESS, which is stored in DB if there are worker + * nodes in raft-api test. + * NOTE: seems the master node won't store task status in memory, + * because only worker nodes store task status in memory. + */ r = client().get(path, ImmutableMap.of("status", "RUNNING")); content = assertResponseStatus(200, r); tasks = assertJsonContains(content, "tasks"); - Assert.assertTrue(tasks.isEmpty()); + Assert.assertTrue(tasks.toString(), tasks.isEmpty()); } @Test diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/BaseUnitTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/BaseUnitTest.java index ab78a17bba..21eb2abef5 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/BaseUnitTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/BaseUnitTest.java @@ -30,12 +30,17 @@ import org.junit.AfterClass; import org.junit.BeforeClass; +import org.slf4j.Logger; +import com.baidu.hugegraph.HugeException; import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.TimeUtil; public class BaseUnitTest { + protected static final Logger LOG = Log.logger(BaseUnitTest.class); + @BeforeClass public static void init() { // pass @@ -67,7 +72,9 @@ protected static final void runWithThreads(int threads, Runnable task) { try { future.get(); } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); + Throwable root = HugeException.rootCause(e); + LOG.error(root.getMessage(), root); + throw new RuntimeException(root.getMessage(), e); } } }