Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set timeout of raft api test to 60s #1738

Merged
merged 3 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be caused by:

  • raft async apply?
  • update status after task.done()?

}

@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