THRIFT-5059: Add cross tests for TZlibTransport in D
Client: D
Patch: Kengo Seki
This closes #1977
diff --git a/lib/d/test/test_utils.d b/lib/d/test/test_utils.d
index 174100b..d0548b7 100644
--- a/lib/d/test/test_utils.d
+++ b/lib/d/test/test_utils.d
@@ -35,6 +35,7 @@
import thrift.transport.buffered;
import thrift.transport.framed;
import thrift.transport.http;
+import thrift.transport.zlib;
// This is a likely victim of @@BUG4744@@ when used with command argument
// parsing.
@@ -79,6 +80,7 @@
buffered,
framed,
http,
+ zlib,
raw
}
@@ -90,6 +92,8 @@
return new TFramedTransportFactory;
case TransportType.http:
return new TServerHttpTransportFactory;
+ case TransportType.zlib:
+ return new TZlibTransportFactory;
case TransportType.raw:
return new TTransportFactory;
}
diff --git a/lib/d/test/thrift_test_client.d b/lib/d/test/thrift_test_client.d
index 49419f7..c9911e2 100644
--- a/lib/d/test/thrift_test_client.d
+++ b/lib/d/test/thrift_test_client.d
@@ -35,6 +35,7 @@
import thrift.transport.buffered;
import thrift.transport.framed;
import thrift.transport.http;
+import thrift.transport.zlib;
import thrift.transport.socket;
import thrift.transport.ssl;
import thrift.util.hashset;
@@ -47,6 +48,7 @@
buffered,
framed,
http,
+ zlib,
raw
}
@@ -68,6 +70,7 @@
bool ssl;
ProtocolType protocolType;
TransportType transportType;
+ bool zlib;
bool trace;
getopt(args,
@@ -75,6 +78,7 @@
"protocol", &protocolType,
"ssl", &ssl,
"transport", &transportType,
+ "zlib", &zlib,
"trace", &trace,
"port", &port,
"host", (string _, string value) {
@@ -102,22 +106,28 @@
socket = new TSocket(host, port);
}
- TProtocol protocol;
+ TTransport transport;
final switch (transportType) {
case TransportType.buffered:
- protocol = createProtocol(new TBufferedTransport(socket), protocolType);
+ transport = new TBufferedTransport(socket);
break;
case TransportType.framed:
- protocol = createProtocol(new TFramedTransport(socket), protocolType);
+ transport = new TFramedTransport(socket);
break;
case TransportType.http:
- protocol = createProtocol(
- new TClientHttpTransport(socket, host, "/service"), protocolType);
+ transport = new TClientHttpTransport(socket, host, "/service");
+ break;
+ case TransportType.zlib:
+ transport = new TZlibTransport(socket);
break;
case TransportType.raw:
- protocol = createProtocol(socket, protocolType);
+ transport = socket;
break;
}
+ if (zlib && transportType != TransportType.zlib) {
+ transport = new TZlibTransport(socket);
+ }
+ TProtocol protocol = createProtocol(transport, protocolType);
auto client = tClient!ThriftTest(protocol);
diff --git a/lib/d/test/thrift_test_server.d b/lib/d/test/thrift_test_server.d
index ce820d6..192ff31 100644
--- a/lib/d/test/thrift_test_server.d
+++ b/lib/d/test/thrift_test_server.d
@@ -42,6 +42,7 @@
import thrift.transport.buffered;
import thrift.transport.framed;
import thrift.transport.http;
+import thrift.transport.zlib;
import thrift.transport.ssl;
import thrift.util.cancellation;
import thrift.util.hashset;
@@ -246,11 +247,12 @@
size_t numIOThreads = 1;
TransportType transportType;
bool ssl = false;
+ bool zlib = false;
bool trace = true;
size_t taskPoolSize = totalCPUs;
getopt(args, "port", &port, "protocol", &protocolType, "server-type",
- &serverType, "ssl", &ssl, "num-io-threads", &numIOThreads,
+ &serverType, "ssl", &ssl, "zlib", &zlib, "num-io-threads", &numIOThreads,
"task-pool-size", &taskPoolSize, "trace", &trace,
"transport", &transportType);
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index e165aa4..d1c21eb 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -214,18 +214,24 @@
"d-cpp_binary_framed-ip-ssl",
"d-cpp_binary_http-ip",
"d-cpp_binary_http-ip-ssl",
+ "d-cpp_binary_zlib-ip",
+ "d-cpp_binary_zlib-ip-ssl",
"d-cpp_compact_buffered-ip",
"d-cpp_compact_buffered-ip-ssl",
"d-cpp_compact_framed-ip",
"d-cpp_compact_framed-ip-ssl",
"d-cpp_compact_http-ip",
"d-cpp_compact_http-ip-ssl",
+ "d-cpp_compact_zlib-ip",
+ "d-cpp_compact_zlib-ip-ssl",
"d-cpp_json_buffered-ip",
"d-cpp_json_buffered-ip-ssl",
"d-cpp_json_framed-ip",
"d-cpp_json_framed-ip-ssl",
"d-cpp_json_http-ip",
"d-cpp_json_http-ip-ssl",
+ "d-cpp_json_zlib-ip",
+ "d-cpp_json_zlib-ip-ssl",
"d-d_binary_http-ip",
"d-d_compact_http-ip",
"d-d_json_http-ip",
@@ -270,60 +276,80 @@
"d-py3_binary-accel_framed-ip-ssl",
"d-py3_binary-accel_http-ip",
"d-py3_binary-accel_http-ip-ssl",
+ "d-py3_binary-accel_zlib-ip",
+ "d-py3_binary-accel_zlib-ip-ssl",
"d-py3_binary_buffered-ip",
"d-py3_binary_buffered-ip-ssl",
"d-py3_binary_framed-ip",
"d-py3_binary_framed-ip-ssl",
"d-py3_binary_http-ip",
"d-py3_binary_http-ip-ssl",
+ "d-py3_binary_zlib-ip",
+ "d-py3_binary_zlib-ip-ssl",
"d-py3_compact-accelc_buffered-ip",
"d-py3_compact-accelc_buffered-ip-ssl",
"d-py3_compact-accelc_framed-ip",
"d-py3_compact-accelc_framed-ip-ssl",
"d-py3_compact-accelc_http-ip",
"d-py3_compact-accelc_http-ip-ssl",
+ "d-py3_compact-accelc_zlib-ip",
+ "d-py3_compact-accelc_zlib-ip-ssl",
"d-py3_compact_buffered-ip",
"d-py3_compact_buffered-ip-ssl",
"d-py3_compact_framed-ip",
"d-py3_compact_framed-ip-ssl",
"d-py3_compact_http-ip",
"d-py3_compact_http-ip-ssl",
+ "d-py3_compact_zlib-ip",
+ "d-py3_compact_zlib-ip-ssl",
"d-py3_json_buffered-ip",
"d-py3_json_buffered-ip-ssl",
"d-py3_json_framed-ip",
"d-py3_json_framed-ip-ssl",
"d-py3_json_http-ip",
"d-py3_json_http-ip-ssl",
+ "d-py3_json_zlib-ip",
+ "d-py3_json_zlib-ip-ssl",
"d-py_binary-accel_buffered-ip",
"d-py_binary-accel_buffered-ip-ssl",
"d-py_binary-accel_framed-ip",
"d-py_binary-accel_framed-ip-ssl",
"d-py_binary-accel_http-ip",
"d-py_binary-accel_http-ip-ssl",
+ "d-py_binary-accel_zlib-ip",
+ "d-py_binary-accel_zlib-ip-ssl",
"d-py_binary_buffered-ip",
"d-py_binary_buffered-ip-ssl",
"d-py_binary_framed-ip",
"d-py_binary_framed-ip-ssl",
"d-py_binary_http-ip",
"d-py_binary_http-ip-ssl",
+ "d-py_binary_zlib-ip",
+ "d-py_binary_zlib-ip-ssl",
"d-py_compact-accelc_buffered-ip",
"d-py_compact-accelc_buffered-ip-ssl",
"d-py_compact-accelc_framed-ip",
"d-py_compact-accelc_framed-ip-ssl",
"d-py_compact-accelc_http-ip",
"d-py_compact-accelc_http-ip-ssl",
+ "d-py_compact-accelc_zlib-ip",
+ "d-py_compact-accelc_zlib-ip-ssl",
"d-py_compact_buffered-ip",
"d-py_compact_buffered-ip-ssl",
"d-py_compact_framed-ip",
"d-py_compact_framed-ip-ssl",
"d-py_compact_http-ip",
"d-py_compact_http-ip-ssl",
+ "d-py_compact_zlib-ip",
+ "d-py_compact_zlib-ip-ssl",
"d-py_json_buffered-ip",
"d-py_json_buffered-ip-ssl",
"d-py_json_framed-ip",
"d-py_json_framed-ip-ssl",
"d-py_json_http-ip",
"d-py_json_http-ip-ssl",
+ "d-py_json_zlib-ip",
+ "d-py_json_zlib-ip-ssl",
"erl-cpp_binary_buffered-ip",
"erl-cpp_compact_buffered-ip",
"erl-csharp_binary_buffered-ip",
diff --git a/test/tests.json b/test/tests.json
index fc9046b..dbee398 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -76,7 +76,8 @@
"transports": [
"http",
"buffered",
- "framed"
+ "framed",
+ "zlib"
],
"sockets": [
"ip",