Skip to content

Commit

Permalink
set timeout of raft api test to 60s (#1738)
Browse files Browse the repository at this point in the history
* set timeout of raft api test to 60s
* improve test error log
* improve error message "Failed to list indexlabels"

Change-Id: Ifa93e46992e79cc9b0adc93ad529b72169ec7a7f
  • Loading branch information
javeme authored Feb 21, 2022
1 parent 88c7abd commit 5cdf770
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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<Map> list = readList(content, type, Map.class);
List<Object> ids = list.stream().map(e -> e.get("id"))
Expand All @@ -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<Map> list = readList(content, type, Map.class);
List<Object> names = list.stream().map(e -> e.get("name"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 5cdf770

Please sign in to comment.