This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch TINKERPOP-2409 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 4223b8c8672e6017713b28036aa880c4d7f387c6 Author: Stephen Mallette <[email protected]> AuthorDate: Fri Nov 20 07:56:25 2020 -0500 TINKERPOP-2409 added a test for expected sockerError behavior --- CHANGELOG.asciidoc | 1 + .../test/integration/traversal-test.js | 26 +++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index d2734ea..333be2c 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -59,6 +59,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * Fixed bug with Bytecode serialization when `Bytecode.toString()` is used in Javascript. * Fixed "toString" for P and TextP to produce valid script representation from bytecode glv steps containing a string predicate in Javascript. * Fixed a bug which could cause Java driver to hang when using `ResultSet.statusAttributes()` +* Added a listener to javascript's `DriverRemoteConnection` to find note errors from websocket connection setup./ * Deprecated `BytecodeUtil` and merged its functionality to the existing `BytecodeHelper`. [[release-3-4-8]] diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js index ead8f2f..03f86f0 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js @@ -22,8 +22,11 @@ */ 'use strict'; +const Mocha = require('mocha'); const assert = require('assert'); +const { AssertionError } = require('assert'); const expect = require('chai').expect; +const DriverRemoteConnection = require('../../lib/driver/driver-remote-connection'); const { Vertex } = require('../../lib/structure/graph'); const { traversal } = require('../../lib/process/anonymous-traversal'); const { GraphTraversalSource, GraphTraversal, statics } = require('../../lib/process/graph-traversal'); @@ -71,6 +74,17 @@ describe('Traversal', function () { after(function () { return connection.close(); }); + describe("#construct", function () { + it('should not hang if server not present', function() { + const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:9998/gremlin', {traversalSource: 'g'})); + return g.V().toList().then(function() { + assert.fail("there is no server so an error should have occurred"); + }).catch(function(err) { + if (err instanceof AssertionError) throw err; + assert.strictEqual(err, "hopefully a nice socketError message of some sort"); + }); + }); + }); describe('#toList()', function () { it('should submit the traversal and return a list', function () { var g = traversal().withRemote(connection); @@ -86,12 +100,12 @@ describe('Traversal', function () { var g = traversal().withRemote(connection); var t = g.V().count(); return t.next().then(function (item1) { - assert.ok(item1); - assert.strictEqual(item1.value, 6); - t.clone().next().then(function (item2) { - assert.ok(item2); - assert.strictEqual(item2.value, 6); - }); + assert.ok(item1); + assert.strictEqual(item1.value, 6); + t.clone().next().then(function (item2) { + assert.ok(item2); + assert.strictEqual(item2.value, 6); + }); }); }); });
