You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2017/12/03 01:02:52 UTC

[22/50] [abbrv] thrift git commit: THRIFT-2998: enable cross test for nodejs http transport, fix missing apache license headers in nodejs Client: nodejs

THRIFT-2998: enable cross test for nodejs http transport,
fix missing apache license headers in nodejs
Client: nodejs

This closes #1403


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/375bfee7
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/375bfee7
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/375bfee7

Branch: refs/heads/0.11.0
Commit: 375bfee701d3caa74074f8afb3d6940e52c45c88
Parents: 5a4f738
Author: James E. King, III <jk...@apache.org>
Authored: Thu Oct 26 00:09:34 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Oct 28 17:54:58 2017 -0400

----------------------------------------------------------------------
 lib/d/src/thrift/internal/ssl_bio.d      |  2 +-
 lib/nodejs/test/browser_client.js        | 18 +++++++
 lib/nodejs/test/client.js                | 12 +++--
 lib/nodejs/test/deep-constructor.test.js | 21 +++++++-
 lib/nodejs/test/exceptions.js            | 19 +++++++
 lib/nodejs/test/helpers.js               | 19 +++++++
 lib/nodejs/test/server.js                | 11 ++--
 lib/nodejs/test/test-cases.js            | 19 +++++++
 test/crossrunner/report.py               |  4 +-
 test/known_failures_Linux.json           | 76 +++++++++++++++++++++++++++
 test/tests.json                          |  3 +-
 11 files changed, 193 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/d/src/thrift/internal/ssl_bio.d
----------------------------------------------------------------------
diff --git a/lib/d/src/thrift/internal/ssl_bio.d b/lib/d/src/thrift/internal/ssl_bio.d
index 796be91..ae85027 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);
   }
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/browser_client.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/browser_client.js b/lib/nodejs/test/browser_client.js
index 27db543..72fd837 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');

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/client.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index a38a66b..9609518 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]

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/deep-constructor.test.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/deep-constructor.test.js b/lib/nodejs/test/deep-constructor.test.js
index 2caeb82..145b668 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)

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/exceptions.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/exceptions.js b/lib/nodejs/test/exceptions.js
index c6f2e4d..0a75770 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');

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/helpers.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/helpers.js b/lib/nodejs/test/helpers.js
index c850c46..5f828b3 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');
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/server.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/server.js b/lib/nodejs/test/server.js
index 6e5cdfa..bad3b17 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]

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/test-cases.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/test-cases.js b/lib/nodejs/test/test-cases.js
index 13722be..bd66dc4 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');

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/test/crossrunner/report.py
----------------------------------------------------------------------
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index 26f7d9e..76324ed 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()

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/test/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index 3b835f3..eda5df0 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",

http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/test/tests.json
----------------------------------------------------------------------
diff --git a/test/tests.json b/test/tests.json
index fdd725c..e62af24 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -169,7 +169,8 @@
     },
     "transports": [
       "buffered",
-      "framed"
+      "framed",
+      "http"
     ],
     "sockets": [
       "ip",