This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch travis-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/travis-fix by this push: new 912f012 turn up logging and enable a couple test 912f012 is described below commit 912f0121a4919b1394500ca0de5f9b10b0df6aa8 Author: stephen <spmalle...@gmail.com> AuthorDate: Mon Nov 25 06:59:11 2019 -0500 turn up logging and enable a couple test --- .../gremlin/server/GremlinServerIntegrateTest.java | 90 +++++++++++----------- .../src/test/resources/log4j-test.properties | 6 +- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 8126151..da8dd38 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java @@ -851,43 +851,43 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration // } // } // -// @SuppressWarnings("ThrowableResultOfMethodCallIgnored") -// @Test -// public void shouldBlockRequestWhenTooBig() throws Exception { -// final Cluster cluster = TestClientFactory.open(); -// final Client client = cluster.connect(); -// -// try { -// final String fatty = IntStream.range(0, 1024).mapToObj(String::valueOf).collect(Collectors.joining()); -// final CompletableFuture<ResultSet> result = client.submitAsync("'" + fatty + "';'test'"); -// final ResultSet resultSet = result.get(10000, TimeUnit.MILLISECONDS); -// resultSet.all().get(10000, TimeUnit.MILLISECONDS); -// fail("Should throw an exception."); -// } catch (TimeoutException te) { -// // the request should not have timed-out - the connection should have been reset, but it seems that -// // timeout seems to occur as well on some systems (it's not clear why). however, the nature of this -// // test is to ensure that the script isn't processed if it exceeds a certain size, so in this sense -// // it seems ok to pass in this case. -// } catch (Exception re) { -// final Throwable root = ExceptionUtils.getRootCause(re); -// // Netty closes the channel to the server on a non-recoverable error such as CorruptedFrameException -// // and the connection is subsequently destroyed. Each of the pending requests are given an error with -// // the following error message. -// // -// // went with two possible error messages here as i think that there is some either non-deterministic -// // behavior around the error message or it's environmentally dependent (e.g. different jdk, versions, etc) -// assertThat(root.getMessage(), Matchers.anyOf(is("Connection to server is no longer active"), is("Connection reset by peer"))); -// -// // validate that we can still send messages to the server -// assertEquals(2, client.submit("1+1").all().join().get(0).getInt()); -// } finally { -// cluster.close(); -// } -// } + @SuppressWarnings("ThrowableResultOfMethodCallIgnored") + @Test + public void shouldBlockRequestWhenTooBig() throws Exception { + final Cluster cluster = TestClientFactory.open(); + final Client client = cluster.connect(); + + try { + final String fatty = IntStream.range(0, 1024).mapToObj(String::valueOf).collect(Collectors.joining()); + final CompletableFuture<ResultSet> result = client.submitAsync("'" + fatty + "';'test'"); + final ResultSet resultSet = result.get(10000, TimeUnit.MILLISECONDS); + resultSet.all().get(10000, TimeUnit.MILLISECONDS); + fail("Should throw an exception."); + } catch (TimeoutException te) { + // the request should not have timed-out - the connection should have been reset, but it seems that + // timeout seems to occur as well on some systems (it's not clear why). however, the nature of this + // test is to ensure that the script isn't processed if it exceeds a certain size, so in this sense + // it seems ok to pass in this case. + } catch (Exception re) { + final Throwable root = ExceptionUtils.getRootCause(re); + // Netty closes the channel to the server on a non-recoverable error such as CorruptedFrameException + // and the connection is subsequently destroyed. Each of the pending requests are given an error with + // the following error message. + // + // went with two possible error messages here as i think that there is some either non-deterministic + // behavior around the error message or it's environmentally dependent (e.g. different jdk, versions, etc) + assertThat(root.getMessage(), Matchers.anyOf(is("Connection to server is no longer active"), is("Connection reset by peer"))); + + // validate that we can still send messages to the server + assertEquals(2, client.submit("1+1").all().join().get(0).getInt()); + } finally { + cluster.close(); + } + } @Test public void shouldFailOnDeadHost() throws Exception { - final Cluster cluster = TestClientFactory.build().maxWaitForConnection(3000).create(); + final Cluster cluster = TestClientFactory.build().create(); final Client client = cluster.connect(); // ensure that connection to server is good @@ -930,17 +930,17 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration cluster.close(); } } -// -// @Test -// public void shouldNotHavePartialContentWithOneResult() throws Exception { -// try (SimpleClient client = TestClientFactory.createWebSocketClient()) { -// final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL) -// .addArg(Tokens.ARGS_GREMLIN, "10").create(); -// final List<ResponseMessage> responses = client.submit(request); -// assertEquals(1, responses.size()); -// assertEquals(ResponseStatusCode.SUCCESS, responses.get(0).getStatus().getCode()); -// } -// } + + @Test + public void shouldNotHavePartialContentWithOneResult() throws Exception { + try (SimpleClient client = TestClientFactory.createWebSocketClient()) { + final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL) + .addArg(Tokens.ARGS_GREMLIN, "10").create(); + final List<ResponseMessage> responses = client.submit(request); + assertEquals(1, responses.size()); + assertEquals(ResponseStatusCode.SUCCESS, responses.get(0).getStatus().getCode()); + } + } // // @Test // public void shouldHavePartialContentWithLongResultsCollection() throws Exception { diff --git a/gremlin-server/src/test/resources/log4j-test.properties b/gremlin-server/src/test/resources/log4j-test.properties index a9aeddd..b76eae7 100644 --- a/gremlin-server/src/test/resources/log4j-test.properties +++ b/gremlin-server/src/test/resources/log4j-test.properties @@ -15,10 +15,10 @@ # specific language governing permissions and limitations # under the License. -log4j.rootLogger=WARN, stdout +log4j.rootLogger=DEBUG, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=[%p] %C - %m%n -log4j.logger.org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor=ERROR -log4j.logger.audit.org.apache.tinkerpop.gremlin.server=INFO +log4j.logger.org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor=DEBUG +log4j.logger.audit.org.apache.tinkerpop.gremlin.server=DEBUG