You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2020/11/20 12:58:45 UTC

[tinkerpop] branch TINKERPOP-2409 created (now 4223b8c)

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a change to branch TINKERPOP-2409
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.


      at 4223b8c  TINKERPOP-2409 added a test for expected sockerError behavior

This branch includes the following new commits:

     new eca67aa  Throw error from DriverRemoteConnection on connection error
     new 4223b8c  TINKERPOP-2409 added a test for expected sockerError behavior

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[tinkerpop] 02/02: TINKERPOP-2409 added a test for expected sockerError behavior

Posted by sp...@apache.org.
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 <st...@amazon.com>
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);
+        });
       });
     });
   });


[tinkerpop] 01/02: Throw error from DriverRemoteConnection on connection error

Posted by sp...@apache.org.
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 eca67aa26a637879e86ed25a33b168223a3f6ad1
Author: Ian Robinson <ia...@amazon.com>
AuthorDate: Thu Nov 19 14:54:21 2020 +0000

    Throw error from DriverRemoteConnection on connection error
---
 .../gremlin-javascript/lib/driver/driver-remote-connection.js          | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 62cbdb5..a85e5a2 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -52,6 +52,9 @@ class DriverRemoteConnection extends RemoteConnection {
   constructor(url, options) {
     super(url);
     this._client = new Client(url, options);
+    this.addListener('socketError',  (err) => {
+        throw err;
+    });
   }
 
   /** @override */