summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E. King, III <jking@apache.org>2017-10-26 00:09:34 -0400
committerJames E. King, III <jking@apache.org>2017-10-28 17:54:58 -0400
commit375bfee701d3caa74074f8afb3d6940e52c45c88 (patch)
treef6bde60d9c4deefacc2658bd0b6be51748766079
parent5a4f7382d2c37231693890be11c6faaec495194a (diff)
downloadthrift-375bfee701d3caa74074f8afb3d6940e52c45c88.tar.gz
THRIFT-2998: enable cross test for nodejs http transport,
fix missing apache license headers in nodejs Client: nodejs This closes #1403
-rw-r--r--lib/d/src/thrift/internal/ssl_bio.d2
-rw-r--r--lib/nodejs/test/browser_client.js18
-rw-r--r--lib/nodejs/test/client.js12
-rw-r--r--lib/nodejs/test/deep-constructor.test.js21
-rw-r--r--lib/nodejs/test/exceptions.js19
-rw-r--r--lib/nodejs/test/helpers.js19
-rw-r--r--lib/nodejs/test/server.js11
-rw-r--r--lib/nodejs/test/test-cases.js19
-rw-r--r--test/crossrunner/report.py4
-rw-r--r--test/known_failures_Linux.json76
-rw-r--r--test/tests.json3
11 files changed, 193 insertions, 11 deletions
diff --git a/lib/d/src/thrift/internal/ssl_bio.d b/lib/d/src/thrift/internal/ssl_bio.d
index 796be91b0..ae850275a 100644
--- a/lib/d/src/thrift/internal/ssl_bio.d
+++ b/lib/d/src/thrift/internal/ssl_bio.d
@@ -73,7 +73,7 @@ private {
void setError(Exception e) nothrow {
ERR_put_error(ERR_LIB_D_EXCEPTION, ERR_F_D_EXCEPTION, ERR_R_D_EXCEPTION,
ERR_FILE_D_EXCEPTION, ERR_LINE_D_EXCEPTION);
- try { GC.addRoot(cast(void*)e); } catch {}
+ try { GC.addRoot(cast(void*)e); } catch (Throwable) {}
ERR_set_error_data(cast(char*)e, ERR_FLAGS_D_EXCEPTION);
}
diff --git a/lib/nodejs/test/browser_client.js b/lib/nodejs/test/browser_client.js
index 27db543be..72fd8375b 100644
--- a/lib/nodejs/test/browser_client.js
+++ b/lib/nodejs/test/browser_client.js
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
var assert = require('assert');
var thrift = require('thrift');
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index a38a66b76..9609518c4 100644
--- a/lib/nodejs/test/client.js
+++ b/lib/nodejs/test/client.js
@@ -32,13 +32,13 @@ var ttypes = require('./gen-nodejs/ThriftTest_types');
var program = require('commander');
program
- .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|json) [protocol]')
- .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed) [transport]')
+ .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|compact|json) [protocol]')
+ .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed|http) [transport]')
.option('--port <port>', 'Set thrift server port number to connect', 9090)
.option('--host <host>', 'Set thrift server host to connect', 'localhost')
.option('--ssl', 'use SSL transport')
.option('--promise', 'test with promise style functions')
- .option('-t, --type <type>', 'Select server type (tcp|multiplex|http)', 'tcp')
+ .option('-t, --type <type>', 'Select server type (http|multiplex|tcp|websocket)', 'tcp')
.parse(process.argv);
var host = program.host;
@@ -47,6 +47,12 @@ var type = program.type;
var ssl = program.ssl;
var promise = program.promise;
+/* for compatibility with cross test invocation for http transport testing */
+if (program.transport === 'http') {
+ program.transport = 'buffered';
+ type = 'http';
+}
+
var options = {
transport: helpers.transports[program.transport],
protocol: helpers.protocols[program.protocol]
diff --git a/lib/nodejs/test/deep-constructor.test.js b/lib/nodejs/test/deep-constructor.test.js
index 2caeb824d..145b66875 100644
--- a/lib/nodejs/test/deep-constructor.test.js
+++ b/lib/nodejs/test/deep-constructor.test.js
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
var ttypes = require('./gen-nodejs/JsDeepConstructorTest_types');
var thrift = require('thrift');
var test = require('tape');
@@ -286,7 +305,7 @@ function createTestCases(serialize, deserialize) {
"Can make list with objects": function(assert) {
var tObj = new ttypes.ComplexList({
- "struct_list_field": [new ttypes.Complex({})]
+ "struct_list_field": [new ttypes.Complex({})]
});
var innerObj = tObj.struct_list_field[0];
assert.ok(innerObj instanceof ttypes.Complex)
diff --git a/lib/nodejs/test/exceptions.js b/lib/nodejs/test/exceptions.js
index c6f2e4d25..0a7577062 100644
--- a/lib/nodejs/test/exceptions.js
+++ b/lib/nodejs/test/exceptions.js
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
'use strict';
var test = require('tape');
var thrift = require('../lib/thrift/thrift.js');
diff --git a/lib/nodejs/test/helpers.js b/lib/nodejs/test/helpers.js
index c850c46c4..5f828b31c 100644
--- a/lib/nodejs/test/helpers.js
+++ b/lib/nodejs/test/helpers.js
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
'use strict';
var thrift = require('../lib/thrift');
diff --git a/lib/nodejs/test/server.js b/lib/nodejs/test/server.js
index 6e5cdfa7a..bad3b1777 100644
--- a/lib/nodejs/test/server.js
+++ b/lib/nodejs/test/server.js
@@ -32,12 +32,12 @@ var ThriftTestHandlerPromise = require('./test_handler').SyncThriftTestHandler;
var ttypes = require('./gen-nodejs/ThriftTest_types');
program
- .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|json|compact)', 'binary')
- .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed)', 'buffered')
+ .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|compact|json)', 'binary')
+ .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed|http)', 'buffered')
.option('--ssl', 'use ssl transport')
.option('--port <port>', 'Set thrift server port', 9090)
.option('--promise', 'test with promise style functions')
- .option('-t, --type <type>', 'Select server type (tcp|multiplex|http)', 'tcp')
+ .option('-t, --type <type>', 'Select server type (http|multiplex|tcp|websocket)', 'tcp')
.parse(process.argv);
var port = program.port;
@@ -47,6 +47,11 @@ var promise = program.promise;
var handler = program.promise ? ThriftTestHandler : ThriftTestHandlerPromise;
+if (program.transport === 'http') {
+ program.transport = 'buffered';
+ type = 'http';
+}
+
var options = {
transport: helpers.transports[program.transport],
protocol: helpers.protocols[program.protocol]
diff --git a/lib/nodejs/test/test-cases.js b/lib/nodejs/test/test-cases.js
index 13722be8b..bd66dc496 100644
--- a/lib/nodejs/test/test-cases.js
+++ b/lib/nodejs/test/test-cases.js
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
'use strict';
var ttypes = require('./gen-nodejs/ThriftTest_types');
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index 26f7d9e99..76324ede1 100644
--- a/test/crossrunner/report.py
+++ b/test/crossrunner/report.py
@@ -332,8 +332,8 @@ class SummaryReporter(TestReporter):
'# then browse:\n',
'# \thttp://localhost:%d/%s/\n' % (8001, self._testdir_rel),
'Full log for each test is here:\n',
- '\ttest/log/client_server_protocol_transport_client.log\n',
- '\ttest/log/client_server_protocol_transport_server.log\n',
+ '\ttest/log/server_client_protocol_transport_client.log\n',
+ '\ttest/log/server_client_protocol_transport_server.log\n',
'%d failed of %d tests in total.\n' % (fail_count, len(self._tests)),
])
self._print_exec_time()
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index 3b835f36e..eda5df01b 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -27,6 +27,12 @@
"cpp-java_compact_http-ip-ssl",
"cpp-java_json_http-ip",
"cpp-java_json_http-ip-ssl",
+ "cpp-nodejs_binary_http-ip",
+ "cpp-nodejs_binary_http-ip-ssl",
+ "cpp-nodejs_compact_http-ip",
+ "cpp-nodejs_compact_http-ip-ssl",
+ "cpp-nodejs_json_http-ip",
+ "cpp-nodejs_json_http-ip-ssl",
"csharp-d_binary_buffered-ip-ssl",
"csharp-d_binary_framed-ip-ssl",
"csharp-d_compact_buffered-ip-ssl",
@@ -83,14 +89,20 @@
"d-nodejs_binary_buffered-ip-ssl",
"d-nodejs_binary_framed-ip",
"d-nodejs_binary_framed-ip-ssl",
+ "d-nodejs_binary_http-ip",
+ "d-nodejs_binary_http-ip-ssl",
"d-nodejs_compact_buffered-ip",
"d-nodejs_compact_buffered-ip-ssl",
"d-nodejs_compact_framed-ip",
"d-nodejs_compact_framed-ip-ssl",
+ "d-nodejs_compact_http-ip",
+ "d-nodejs_compact_http-ip-ssl",
"d-nodejs_json_buffered-ip",
"d-nodejs_json_buffered-ip-ssl",
"d-nodejs_json_framed-ip",
"d-nodejs_json_framed-ip-ssl",
+ "d-nodejs_json_http-ip",
+ "d-nodejs_json_http-ip-ssl",
"d-py3_binary-accel_buffered-ip",
"d-py3_binary-accel_buffered-ip-ssl",
"d-py3_binary-accel_framed-ip",
@@ -169,6 +181,70 @@
"java-d_compact_buffered-ip",
"java-d_compact_buffered-ip-ssl",
"java-d_compact_framed-ip",
+ "nodejs-cpp_binary_http-ip",
+ "nodejs-cpp_binary_http-ip-ssl",
+ "nodejs-cpp_compact_http-ip",
+ "nodejs-cpp_compact_http-ip-ssl",
+ "nodejs-cpp_json_http-ip",
+ "nodejs-cpp_json_http-ip-ssl",
+ "nodejs-d_binary_buffered-ip",
+ "nodejs-d_binary_buffered-ip-ssl",
+ "nodejs-d_binary_framed-ip",
+ "nodejs-d_binary_framed-ip-ssl",
+ "nodejs-d_binary_http-ip",
+ "nodejs-d_binary_http-ip-ssl",
+ "nodejs-d_compact_buffered-ip",
+ "nodejs-d_compact_buffered-ip-ssl",
+ "nodejs-d_compact_framed-ip",
+ "nodejs-d_compact_framed-ip-ssl",
+ "nodejs-d_compact_http-ip",
+ "nodejs-d_compact_http-ip-ssl",
+ "nodejs-d_json_buffered-ip",
+ "nodejs-d_json_buffered-ip-ssl",
+ "nodejs-d_json_framed-ip",
+ "nodejs-d_json_framed-ip-ssl",
+ "nodejs-d_json_http-ip",
+ "nodejs-d_json_http-ip-ssl",
+ "nodejs-dart_binary_buffered-ip",
+ "nodejs-dart_binary_framed-ip",
+ "nodejs-dart_binary_http-ip",
+ "nodejs-dart_compact_buffered-ip",
+ "nodejs-dart_compact_framed-ip",
+ "nodejs-dart_compact_http-ip",
+ "nodejs-dart_json_buffered-ip",
+ "nodejs-dart_json_framed-ip",
+ "nodejs-dart_json_http-ip",
+ "nodejs-go_binary_http-ip",
+ "nodejs-go_binary_http-ip-ssl",
+ "nodejs-go_compact_http-ip",
+ "nodejs-go_compact_http-ip-ssl",
+ "nodejs-go_json_http-ip",
+ "nodejs-go_json_http-ip-ssl",
+ "nodejs-hs_binary_http-ip",
+ "nodejs-hs_compact_http-ip",
+ "nodejs-hs_json_http-ip",
+ "nodejs-java_binary_http-ip",
+ "nodejs-java_binary_http-ip-ssl",
+ "nodejs-java_compact_http-ip",
+ "nodejs-java_compact_http-ip-ssl",
+ "nodejs-java_json_http-ip",
+ "nodejs-java_json_http-ip-ssl",
+ "nodejs-js_json_http-ip",
+ "nodejs-lua_binary_http-ip",
+ "nodejs-lua_compact_http-ip",
+ "nodejs-lua_json_http-ip",
+ "nodejs-netcore_binary_buffered-ip",
+ "nodejs-netcore_binary_buffered-ip-ssl",
+ "nodejs-netcore_binary_framed-ip",
+ "nodejs-netcore_binary_framed-ip-ssl",
+ "nodejs-netcore_compact_buffered-ip",
+ "nodejs-netcore_compact_buffered-ip-ssl",
+ "nodejs-netcore_compact_framed-ip",
+ "nodejs-netcore_compact_framed-ip-ssl",
+ "nodejs-netcore_json_buffered-ip",
+ "nodejs-netcore_json_buffered-ip-ssl",
+ "nodejs-netcore_json_framed-ip",
+ "nodejs-netcore_json_framed-ip-ssl",
"rs-csharp_binary_buffered-ip",
"rs-csharp_compact_buffered-ip",
"rs-csharp_binary_framed-ip",
diff --git a/test/tests.json b/test/tests.json
index fdd725cf5..e62af2485 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -169,7 +169,8 @@
},
"transports": [
"buffered",
- "framed"
+ "framed",
+ "http"
],
"sockets": [
"ip",