This is an automated email from the ASF dual-hosted git repository.
colegreer pushed a commit to branch 3.8-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/3.8-dev by this push:
new dee83b3335 Add Support for Node 22 and 24 (#3119)
dee83b3335 is described below
commit dee83b3335c095bf697e4fe2b12fcf2323bb0d89
Author: Cole Greer <[email protected]>
AuthorDate: Mon Nov 10 14:15:02 2025 -0800
Add Support for Node 22 and 24 (#3119)
Enables support for Node 22 and 24, and expands the github action test
infrastructure to test all of node 20, 22, and 24. This allows us to ensure
support for all currently active LTS versions of Node, instead of pinning our
support to a single major version at a time.
Note that there was an issue related to the websocket library handling in
node 22. As of node 22, the builtin global websockets does not allow for
customized user-agent and compression headers. To limit the impact of this
issue, global websockets is only used if both the user agent and compression
are disabled, otherwise we fallback to the external ws library.
---------
Co-authored-by: xiazcy <[email protected]>
---
.github/workflows/build-test.yml | 76 +++++++++++++++++-----
CHANGELOG.asciidoc | 3 +-
docs/src/reference/gremlin-variants.asciidoc | 2 +-
gremlin-javascript/pom.xml | 1 +
.../gremlin-javascript/docker-compose.yml | 2 +-
.../gremlin-javascript/lib/driver/connection.js | 9 ++-
.../test/integration/client-behavior-tests.js | 2 +-
.../test/integration/socket-connection-tests.js | 3 +-
pom.xml | 1 +
9 files changed, 75 insertions(+), 24 deletions(-)
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index b84f2dbebf..04db0a939e 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -198,16 +198,67 @@ jobs:
run: |
mvn clean install -pl $EXCLUDE_MODULES -q -DskipTests -Dci
mvn verify -pl gremlin-driver -DskipIntegrationTests=false
- javascript:
- name: javascript
+ javascript-node20:
+ name: javascript-all-node20
timeout-minutes: 15
needs: cache-gremlin-server-docker-image
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- # Windows Disabled until Linux containers are supported on Windows
runners: https://github.com/actions/virtual-environments/issues/252
- # os: [ubuntu-latest, windows-latest]
- os: [ubuntu-latest]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v5
+ - name: Set up JDK 11
+ uses: actions/setup-java@v5
+ with:
+ java-version: '11'
+ distribution: 'temurin'
+ - name: Get Cached Server Base Image
+ uses: actions/cache@v4
+ id: gremlin-server-test-docker-image
+ with:
+ path: |
+ ./gremlin-server/*
+ ~/.m2/repository/org/apache/tinkerpop/*
+ key: ${{ github.sha }}
+ - name: Load Docker Image
+ working-directory: ./gremlin-server
+ run: docker load --input gremlin-server.tar
+ - name: Build with Maven
+ run: |
+
EXCLUDE="-:gremlin-dotnet-source,-:gremlin-dotnet-tests,-:gremlin-go,-:gremlin-python,$EXCLUDE_FOR_GLV"
+ mvn clean install -pl $EXCLUDE -q -DskipTests -Dci
+ mvn verify -pl :gremlin-javascript,:gremlint,:gremlin-mcp
-Dnode.test.version=20
+ javascript-node22:
+ name: javascript-glv-node22
+ timeout-minutes: 15
+ needs: cache-gremlin-server-docker-image
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v5
+ - name: Set up JDK 11
+ uses: actions/setup-java@v5
+ with:
+ java-version: '11'
+ distribution: 'temurin'
+ - name: Get Cached Server Base Image
+ uses: actions/cache@v4
+ id: gremlin-server-test-docker-image
+ with:
+ path: |
+ ./gremlin-server/*
+ ~/.m2/repository/org/apache/tinkerpop/*
+ key: ${{ github.sha }}
+ - name: Load Docker Image
+ working-directory: ./gremlin-server
+ run: docker load --input gremlin-server.tar
+ - name: Build with Maven
+ run: |
+
EXCLUDE="-:gremlin-dotnet-source,-:gremlin-dotnet-tests,-:gremlin-go,-:gremlin-python,$EXCLUDE_FOR_GLV"
+ mvn clean install -pl $EXCLUDE -q -DskipTests -Dci
+ mvn verify -pl :gremlin-javascript -Dnode.test.version=22
+ javascript-node24:
+ name: javascript-glv-node24
+ timeout-minutes: 15
+ needs: cache-gremlin-server-docker-image
+ runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 11
@@ -216,7 +267,6 @@ jobs:
java-version: '11'
distribution: 'temurin'
- name: Get Cached Server Base Image
- if: matrix.os == 'ubuntu-latest'
uses: actions/cache@v4
id: gremlin-server-test-docker-image
with:
@@ -224,12 +274,6 @@ jobs:
./gremlin-server/*
~/.m2/repository/org/apache/tinkerpop/*
key: ${{ github.sha }}
-# - name: Download Server Base Image
-# if: matrix.os == 'windows-latest'
-# uses: actions/download-artifact@v3
-# with:
-# name: ${{ github.sha }}
-# path: ./gremlin-server
- name: Load Docker Image
working-directory: ./gremlin-server
run: docker load --input gremlin-server.tar
@@ -237,7 +281,7 @@ jobs:
run: |
EXCLUDE="-:gremlin-dotnet-source,-:gremlin-dotnet-tests,-:gremlin-go,-:gremlin-python,$EXCLUDE_FOR_GLV"
mvn clean install -pl $EXCLUDE -q -DskipTests -Dci
- mvn verify -pl :gremlin-javascript,:gremlint,:gremlin-mcp
+ mvn verify -pl :gremlin-javascript -Dnode.test.version=24
python:
name: python
timeout-minutes: 20
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e140262567..67c6e0d61c 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -105,9 +105,10 @@ This release also includes changes from <<release-3-7-XXX,
3.7.XXX>>.
* Introduced `NotP` class for negation of `P`.
* Add barriers to `group(String)`, `groupCount(String)`, `tree(String)` and
`subgraph(String)` steps.
* Increase minimum Java version from 1.8 to 11 for building and running.
+* Add support for Node 22 and 24 alongside Node 20.
* Moved all lambda oriented Gremlin tests to `LambdaStepTest` in the Java test
suite.
* Removed the `@RemoteOnly` testing tag in Gherkin as lambda tests have all
been moved to the Java test suite.
-* Updated gremlin-javascript to use GraphBinary as default instead of
GraphSONv3
+* Updated gremlin-javascript to use GraphBinary as default instead of
GraphSONv3.
* Added the `asNumber()` step to perform number conversion.
* Modified `asNumber()` to handle `OffsetDateTime` and `Date`
* Modified `dateDiff()` to return milliseconds instead of seconds
diff --git a/docs/src/reference/gremlin-variants.asciidoc
b/docs/src/reference/gremlin-variants.asciidoc
index 7c58a551af..4554e982b0 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -1407,7 +1407,7 @@ g.inject(java.awt.Color.red, "hi",
123).is(P.typeOf(java.awt.Color))
== Gremlin-JavaScript
image:gremlin-js.png[width=130,float=right] Apache TinkerPop's
Gremlin-JavaScript implements Gremlin within the
-JavaScript language. It targets Node.js runtime and can be used on different
operating systems on any Node.js 6 or
+JavaScript language. It targets Node.js runtime and can be used on different
operating systems on any Node.js 20 or
above. Since the JavaScript naming conventions are very similar to that of
Java, it should be very easy to switch
between Gremlin-Java and Gremlin-JavaScript.
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index fcafca0e8a..98e59c2dbd 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -260,6 +260,7 @@ limitations under the License.
<ABS_PROJECT_HOME>${project.basedir}/../</ABS_PROJECT_HOME>
<!-- setting this env variable is
needed to be cross-platform compatible -->
<HOME>${user.home}</HOME>
+
<NODE_VERSION>${node.test.version}</NODE_VERSION>
</environmentVariables>
<executable>docker</executable>
<arguments>
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml
b/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml
index facf0707a1..ceabb54788 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml
@@ -43,7 +43,7 @@ services:
gremlin-js-integration-tests:
container_name: gremlin-js-integration-tests
- image: node:20
+ image: node:${NODE_VERSION:-20}
volumes:
- .:/js_app
-
../../../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features:/gremlin-test
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
index 3904b3a200..b7973b96ae 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
@@ -135,9 +135,12 @@ class Connection extends EventEmitter {
'perMessageDeflate',
]);
// Check if any `ws` specific options are provided and are non-null /
non-undefined
- const hasWsSpecificOptions = Object.entries(this.options).some(
- ([key, value]) => wsSpecificOptions.has(key) && ![null,
undefined].includes(value),
- );
+ const hasWsSpecificOptions =
+ Object.entries(this.options).some(
+ ([key, value]) => wsSpecificOptions.has(key) && ![null,
undefined].includes(value),
+ ) ||
+ this._enableCompression || // we need to check the presence of this
variable and pass this into ws
+ this._enableUserAgentOnConnect; // global websocket will send "node" as
user agent by default which doesn't comply with Gremlin
// Only use the global websocket if we don't have any unsupported options
const useGlobalWebSocket = !hasWsSpecificOptions && globalThis.WebSocket;
const WebSocket = useGlobalWebSocket || (await import('ws')).default;
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/client-behavior-tests.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/client-behavior-tests.js
index d43963813e..a11110f9e8 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/client-behavior-tests.js
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/client-behavior-tests.js
@@ -59,7 +59,7 @@ describe('Client', function () {
let result = await noUserAgentClient.submit('1', null,
{requestId: settings.USER_AGENT_REQUEST_ID});
- assert.strictEqual(result.first(), "");
+ assert.ok(result.first() === "" || result.first() === "node"); //
The default node websocket library may use a default user-agent of "node" if
none is specified
await noUserAgentClient.close();
});
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/socket-connection-tests.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/socket-connection-tests.js
index 47ac00fa91..e39ab537ed 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/socket-connection-tests.js
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/socket-connection-tests.js
@@ -78,7 +78,8 @@ describe('Connection', function () {
globalThis.WebSocket = function () {
globalWebsocketCalls++;
};
- const connection =
helper.getDriverRemoteConnection(`ws://localhost:${testServerPort}/401`);
+ const connection =
helper.getDriverRemoteConnection(`ws://localhost:${testServerPort}/401`,
+ {enableCompression: false, enableUserAgentOnConnect: false}); //
Global WebSocket is not compatible with customized compression and user agent
headers
return connection
.open()
.catch(() => {})
diff --git a/pom.xml b/pom.xml
index d97642f884..23e94d4ba2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -226,6 +226,7 @@ limitations under the License.
<runtime.npm.version>10.8.2</runtime.npm.version>
<runtime.node.version>v20.19.4</runtime.node.version>
+ <node.test.version>20</node.test.version>
</properties>
<build>
<directory>${basedir}/target</directory>