Skip to content

Commit

Permalink
THRIFT-5564: Add nodejs tests to github actions (#3082)
Browse files Browse the repository at this point in the history
These tests exist, but don't currently run on github actions. This adds a new job to run these.

This also fixes the regression in the tests caused by #3014.
  • Loading branch information
cameron-martin authored Jan 12, 2025
1 parent 1e72949 commit ab70652
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,32 @@ jobs:
- name: Run make check for python
run: make -C lib/py check

lib-nodejs:
needs: compiler
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Run bootstrap
run: ./bootstrap.sh

- name: Run configure
run: |
./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-nodejs/with-nodejs/')
- uses: actions/download-artifact@v4
with:
name: thrift-compiler
path: compiler/cpp

- name: Run thrift-compiler
run: |
chmod a+x compiler/cpp/thrift
compiler/cpp/thrift -version
- name: Run tests
run: make -C lib/nodejs check

cross-test:
needs:
- lib-java-kotlin
Expand Down
4 changes: 2 additions & 2 deletions lib/nodejs/lib/thrift/thrift.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function TApplicationException(type, message) {
};
util.inherits(TApplicationException, TException);

TApplicationException.prototype.read = function(input) {
TApplicationException.prototype[Symbol.for("read")] = TApplicationException.prototype.read = function(input) {
var ftype;
var ret = input.readStructBegin('TApplicationException');

Expand Down Expand Up @@ -121,7 +121,7 @@ TApplicationException.prototype.read = function(input) {
input.readStructEnd();
};

TApplicationException.prototype.write = function(output){
TApplicationException.prototype[Symbol.for("write")] = TApplicationException.prototype.write = function(output){
output.writeStructBegin('TApplicationException');

if (this.message) {
Expand Down
8 changes: 4 additions & 4 deletions lib/nodejs/test/deep-constructor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function serializeBinary(data) {
buff = msg;
});
const prot = new thrift.TBinaryProtocol(transport);
data.write(prot);
data[Symbol.for("write")](prot);
prot.flush();
return buff;
}
Expand All @@ -37,7 +37,7 @@ function deserializeBinary(serialized, type) {
const t = new thrift.TFramedTransport(serialized);
const p = new thrift.TBinaryProtocol(t);
const data = new type();
data.read(p);
data[Symbol.for("read")](p);
return data;
}

Expand All @@ -48,7 +48,7 @@ function serializeJSON(data) {
});
const protocol = new thrift.TJSONProtocol(transport);
protocol.writeMessageBegin("", 0, 0);
data.write(protocol);
data[Symbol.for("write")](protocol);
protocol.writeMessageEnd();
protocol.flush();
return buff;
Expand All @@ -59,7 +59,7 @@ function deserializeJSON(serialized, type) {
const protocol = new thrift.TJSONProtocol(transport);
protocol.readMessageBegin();
const data = new type();
data.read(protocol);
data[Symbol.for("read")](protocol);
protocol.readMessageEnd();
return data;
}
Expand Down

0 comments on commit ab70652

Please sign in to comment.