thrift/test
2022-09-05 22:04:22 +02:00
..
audit Renamed, relocated, and reformated the audit tool's readme file 2015-07-09 20:55:53 -05:00
c_glib Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
cl THRIFT-5410 CL build broken: Component :NET.DIDIERVERNA.CLON.TERMIO not found 2022-08-30 23:58:58 +02:00
cpp Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
crossrunner Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
dart Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
erl Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
features Updated known cross failures list 2020-03-15 19:31:26 +01:00
go Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
haxe THRIFT-5593 Implement uuid for Haxe 2022-09-05 22:04:21 +02:00
keys script to regenerate server/client keys 2022-07-01 21:15:57 +02:00
lua Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
netstd THRIFT-5591 Add uuid type to IDL and implement reference code (+ improved self-tests) 2022-09-05 22:04:20 +02:00
ocaml THRIFT-2886 Integrate binary type in standard Thrift cross test 2015-01-03 17:37:54 +01:00
partial THRIFT-5443: add support for partial Thrift deserialization 2021-11-20 00:57:57 +01:00
perl Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
php Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
py Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
py.tornado Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
py.twisted Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
rb Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
rs Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
threads THRIFT-4730: remove pthread code and refactor, ending up with just ThreadFactory 2019-01-11 09:13:12 -05:00
v0.16 Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
AnnotationTest.thrift THRIFT-5588 Remove slist/senum from IDL 2022-06-06 01:44:16 +02:00
BrokenConstants.thrift THRIFT-387. Add license headers to a bunch of files 2009-03-30 21:35:00 +00:00
ConstantsDemo.thrift THRIFT-5591 Add uuid type to IDL and implement reference code (+ improved self-tests) 2022-09-05 22:04:20 +02:00
DebugProtoTest.thrift THRIFT-5591 Add uuid type to IDL and implement reference code (+ improved self-tests) 2022-09-05 22:04:20 +02:00
DenseLinkingTest.thrift THRIFT-2637 "java:fullcamel_service_methods" option to automatically camel-case Java service methods 2014-07-25 23:26:11 +02:00
DocTest.thrift THRIFT-3762 Fix warnings for deprecated Thrift "byte" fields 2016-03-29 12:03:34 +09:00
DoubleConstantsTest.thrift THRIFT-4476: Typecasting problem on double list items, 2018-03-20 16:28:15 -04:00
EnumContainersTest.thrift THRIFT-3357: Generate EnumSet/EnumMap where elements/keys are enums 2017-09-21 13:57:09 -07:00
EnumTest.thrift THRIFT-3921: Add ostream operator<< functions for enums (working with THRIFT-4060) 2017-02-18 14:30:46 -05:00
FullCamelTest.thrift THRIFT-3435 Separate package for fullcamel thrift 2015-12-06 10:11:19 +09:00
Identifiers.thrift THRIFT-4953: Missing Field Identifiers 2019-09-06 10:40:53 -06:00
Include.thrift Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
index.html THRIFT-3571 Make feature test result browsable 2016-01-24 00:13:44 +09:00
Int64Test.thrift THRIFT-4675: Fix int64 constants generation for map keys 2019-01-25 10:03:37 -05:00
JsDeepConstructorTest.thrift THRIFT-3748 Node.js Deserialization of lists of lists is broken 2016-09-26 01:42:02 +09:00
known_failures_Linux.json THRIFT-5580: refactor kotlin cross tests (#2600) 2022-05-08 22:52:26 -04:00
Makefile.am Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
ManyOptionals.thrift THRIFT-1469. java: Java isset space optimization 2011-12-21 18:13:29 +00:00
ManyTypedefs.thrift THRIFT-387. Add license headers to a bunch of files 2009-03-30 21:35:00 +00:00
NameConflictTest.thrift THRIFT-2951 Fix Erlang name conflict test 2015-02-05 12:39:34 +11:00
OptionalRequiredTest.thrift THRIFT-3464 Fix several defects in c_glib code generator 2015-12-06 10:11:16 +09:00
README.md Remove execute bit from plain text files in git (#2611) 2022-05-24 05:19:41 -04:00
rebuild_known_failures.sh THRIFT-3347 Improve cross test servers and clients 2015-09-23 21:20:38 +02:00
Recursive.thrift THRIFT-2768: Whitespace Fixup 2014-10-03 20:30:38 +02:00
result.js THRIFT-3571 Make feature test result browsable 2016-01-24 00:13:44 +09:00
ReuseObjects.thrift Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
Service.thrift Implement episodic compilation for js code generation 2019-06-21 06:38:32 -04:00
SmallTest.thrift THRIFT-5588 Remove slist/senum from IDL 2022-06-06 01:44:16 +02:00
SpecificNameTest.thrift THRIFT-5179: Fix generated code for struct's named "a" or "b" 2020-04-28 07:23:15 +01:00
StressTest.thrift THRIFT-3762 Fix warnings for deprecated Thrift "byte" fields 2016-03-29 12:03:34 +09:00
test.py THRIFT-5564: setup cross test in GitHub action (#2602) 2022-05-09 13:56:30 -04:00
tests.json THRIFT-5580: refactor kotlin cross tests (#2600) 2022-05-08 22:52:26 -04:00
ThriftTest.thrift THRIFT-5591 Add uuid type to IDL and implement reference code (+ improved self-tests) 2022-09-05 22:04:20 +02:00
TypedefTest.thrift THRIFT-1040 Can't end typedef lines with a semicolon 2014-09-11 22:36:41 +02:00
Types.thrift Implement episodic compilation for js code generation 2019-06-21 06:38:32 -04:00
UnsafeTypes.thrift THRIFT-4555 Optionally disable copies of binary fields in constructors, getters and setters. 2018-04-17 07:21:46 +01:00
valgrind.suppress THRIFT-4106: fix errors concurrency_test was identifying 2017-09-07 10:13:29 -07:00
VoidMethExceptionsTest.thrift THRIFT-5519 Java async client loses exceptions in void methods 2022-03-02 22:14:55 +01:00

Apache Thrift - integration test suite

This is the cross everything integration test suite for Apache Thrift.

Run

A. Using Make

The test can be executed by:

make cross

This starts the test.py script which does the real cross test with different transports, protocols and languages.

Note that this skips any language that is not built locally. It also skips tests that are known to be failing. If you need more control over which tests to run, read following section.

B. Using test script directly

Alternatively, you can invoke test.py directly. You need to runmake precross once before executing it for the first time.

For example, if you changed something in nodejs library and need to verify the patch, you can skip everything except nodejs itself and some reference implementation (currently cpp and java are recommended) like this:

./configure --without-c_glib --without-erlang --without-lua ...
make precross -j8
test/test.py --server cpp,java --client nodejs
test/test.py --server nodejs --client cpp,java

Another useful flag is --regex. For example, to run all tests that involve Java TBinaryProtocol:

test/test.py --regex "java.*binary"

Test case definition file

The cross test cases are defined in tests.json. The root element is collection of test target definitions. Each test target definition looks like this:

{
  "name": "somelib",

  "client": {
    "command": ["somelib_client_executable"],
    "workdir": "somelib/bin",
    "protocols": ["binary"],
    "transports": ["buffered"],
    "sockets": ["ip"],
  },
  "server": {
    "command": ["somelib_server_executable"],
    "workdir": "somelib/bin",
    "protocols": ["binary"],
    "transports": ["buffered"],
    "sockets": ["ip", "ip-ssl"],
  }
}

Either client or server definition or both should be present.

Parameters that are common to both client and server can be put to target definition root:

{
  "name": "somelib",

  "workdir": "somelib/bin",
  "protocols": ["binary"],
  "transports": ["buffered"],
  "sockets": ["ip"],

  "client": { "command": ["somelib_client_executable"] },
  "server": {
    "command": ["somelib_server_executable"],
    "sockets": ["ip-ssl"]
  }
}

For the complete list of supported keys and their effect, see source code comment at the opt of crossrunner/collect.py.

List of known failures

Since many cross tests currently fail (mainly due to partial incompatibility around exception handling), the test script specifically report for "not known before" failures.

For this purpose, test cases known to (occasionally) fail are listed in known_failures_<platform>.json where <platform> matches with python platform.system() string.

Currently, only Linux version is included.

FYI, the file is initially generated by

test/test.py --update-expected-failures=overwrite

after a full test run, then repeatedly

test/test.py --skip-known-failures
test/test.py --update-expected-failures=merge

to update the known failures, run

make fail

Test executable specification

Command line parameters

Unit tests for languages are usually located under lib//test/ cross language tests according to ThriftTest.thrift shall be provided for every language including executables with the following command line interface:

Server command line interface:

$ ./TestServer -h
Allowed options:
  -h | --help                  produce help message
  --port=arg (9090)            Port number to listen
  --domain-socket=arg          Unix Domain Socket (e.g. /tmp/ThriftTest.thrift)
  --pipe=arg                   Windows Named Pipe (e.g. MyThriftPipe)
  --server-type=arg (simple)   type of server, "simple", "thread-pool",
                               "threaded", or "nonblocking"
  --transport=arg (buffered)   transport: buffered, framed, http, anonpipe, zlib
  --protocol=arg (binary)      protocol: binary, compact, header, json
  --multiplex                  Add TMultiplexedProtocol service name "ThriftTest"
  --abstract-namespace         Create the domain socket in the Abstract Namespace 
                               (no connection with filesystem pathnames)
  --ssl                        Encrypted Transport using SSL
  --zlib                       Wrapped Transport using Zlib
  --processor-events           processor-events
  -n=arg | --workers=arg (=4)  Number of thread pools workers. Only valid for
                               thread-pool server type

Client command line interface:

$ ./TestClient -h
Allowed options:
  -h | --help                  produce help message
  --host=arg (localhost)       Host to connect
  --port=arg (9090)            Port number to connect
  --domain-socket=arg          Domain Socket (e.g. /tmp/ThriftTest.thrift),
                               instead of host and port
  --pipe=arg                   Windows Named Pipe (e.g. MyThriftPipe)
  --anon-pipes hRead hWrite    Windows Anonymous Pipes pair (handles)
  --abstract-namespace         Create the domain socket in the Abstract Namespace
                               (no connection with filesystem pathnames)
  --transport=arg (buffered)   Transport: buffered, framed, http, evhttp, zlib
  --protocol=arg (binary)      Protocol: binary, compact, header, json
  --multiplex                  Add TMultiplexedProtocol service name "ThriftTest"
  --ssl                        Encrypted Transport using SSL
  --zlib                       Wrap Transport with Zlib
  -n=arg | --testloops=arg (1) Number of Tests
  -t=arg | --threads=arg (1)   Number of Test threads

If you have executed the make check or make cross then you will be able to browse gen-html/ThriftTest.html with the test documentation.

Return code

The return code (exit code) shall be 0 on success, or an integer in the range 1 - 255 on errors. In order to signal failed tests, the return code shall be composed from these bits to indicate failing tests:

  #define TEST_BASETYPES     1  // 0000 0001
  #define TEST_STRUCTS       2  // 0000 0010
  #define TEST_CONTAINERS    4  // 0000 0100
  #define TEST_EXCEPTIONS    8  // 0000 1000
  #define TEST_UNKNOWN      64  // 0100 0000 (Failed to prepare environment etc.)
  #define TEST_TIMEOUT     128  // 1000 0000
  #define TEST_NOTUSED      48  // 0011 0000 (reserved bits)

Tests that have not been executed at all count as errors.

Example:

During tests, the test client notices that some of the Struct tests fail. Furthermore, due to some other problem none of the Exception tests is executed. Therefore, the test client returns the code 10 = 2 | 8, indicating the failure of both test 2 (TEST_STRUCTS) and test 8 (TEST_EXCEPTIONS).

SSL

Test Keys and Certificates are provided in multiple formats under the following directory test/keys