thrift/test
2016-02-04 14:28:24 +09:00
..
audit Renamed, relocated, and reformated the audit tool's readme file 2015-07-09 20:55:53 -05:00
c_glib THRIFT-3567 GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed 2016-01-19 22:00:48 +01:00
cpp THRIFT-3531 Create cross lang feature test for string and container read length limit 2016-01-11 11:41:56 +09:00
crossrunner THRIFT-3596 Better conformance to PEP8 2016-02-04 14:28:24 +09:00
dart THRIFT-3452 .travis.yml: Migrating from legacy to container-based infrastructure 2015-12-05 11:28:27 +09:00
erl THRIFT-3421 rebar as dependency instead of bundling 2015-11-15 01:50:38 +01:00
features THRIFT-3596 Better conformance to PEP8 2016-02-04 14:28:24 +09:00
go THRIFT-3251 Add http transport for server to Go lib 2016-01-28 23:05:02 +01:00
haxe THRIFT-3341 Add testBool methods 2015-09-22 00:29:32 +02:00
hs THRIFT-3482 Haskell JSON protocol does not encode binary field as Base64 2015-12-13 23:48:22 +09:00
keys THRIFT-3505 Enhance Python TSSLSocket 2016-01-03 02:39:51 +09:00
lua THRIFT-3592 Add basic test client 2016-02-03 01:07:43 +09:00
ocaml THRIFT-2886 Integrate binary type in standard Thrift cross test 2015-01-03 17:37:54 +01:00
perl THRIFT-3402: add unix socket support to perl 2015-11-06 21:21:01 +09:00
php THRIFT-3211: add php client compact protocol to make cross test 2015-07-03 20:48:50 +02:00
py THRIFT-3596 Better conformance to PEP8 2016-02-04 14:28:24 +09:00
py.tornado THRIFT-3596 Better conformance to PEP8 2016-02-04 14:28:24 +09:00
py.twisted THRIFT-3596 Better conformance to PEP8 2016-02-04 14:28:24 +09:00
rb THRIFT-3495 Minor enhancements and fixes for cross test 2015-12-24 02:11:17 +09:00
threads Thrift-2029:Port C++ tests to Windows 2014-01-07 21:42:01 -05:00
AnnotationTest.thrift THRIFT-2768: Whitespace Fixup 2014-10-03 20:30:38 +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-3477 Parser fails on enum item that starts with 'E' letter and continues with number 2015-12-08 23:03:17 +01:00
DebugProtoTest.thrift THRIFT-3504 Fix FastbinaryTest.py 2016-01-02 22:54:16 +09: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-3501 Forward slash in comment causes compiler error 2016-01-28 23:03:24 +01:00
EnumTest.thrift THRIFT-3477 Parser fails on enum item that starts with 'E' letter and continues with number 2015-12-08 21:05:52 +01:00
FullCamelTest.thrift THRIFT-3435 Separate package for fullcamel thrift 2015-12-06 10:11:19 +09:00
Include.thrift THRIFT-1995: IDL can generate uncompilable ocde 2013-06-09 05:28:47 -07:00
index.html THRIFT-3571 Make feature test result browsable 2016-01-24 00:13:44 +09:00
JavaBeansTest.thrift THRIFT-734. java: Can't use primitive types in service definitions for bean generated code 2010-03-16 03:13:26 +00:00
JsDeepConstructorTest.thrift THRIFT-3293 JavaScript: null values turn into empty structs in constructor 2015-08-16 19:17:33 +10:00
known_failures_Linux.json THRIFT-3592 Add basic test client 2016-02-03 01:07:43 +09:00
Makefile.am THRIFT-3592 Add basic test client 2016-02-03 01:07:43 +09: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 THRIFT-3360 Improve cross test servers and clients further 2015-09-28 20:38:37 +02: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 THRIFT-2368 New option: reuse-objects for Java generator 2014-03-31 16:21:37 +02:00
SmallTest.thrift THRIFT-387. Add license headers to a bunch of files 2009-03-30 21:35:00 +00:00
StressTest.thrift THRIFT-2497 server and client for test/go, also several fixes and improvements 2014-05-08 23:18:44 +02:00
test.py THRIFT-3596 Better conformance to PEP8 2016-02-04 14:28:24 +09:00
tests.json THRIFT-3592 Add basic test client 2016-02-03 01:07:43 +09:00
ThriftTest.thrift Remove a line break that broke 'grep -v' in test/go/Makefile.am 2015-11-28 22:34:01 +09:00
TypedefTest.thrift THRIFT-1040 Can't end typedef lines with a semicolon 2014-09-11 22:36:41 +02:00
valgrind.suppress THRIFT-3086 add valgrind suppression support to the ExperimentalMemCheck test run 2015-05-09 23:40:54 +02: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-csharp --without-erlang --without-lua ...
make precross -j8
test/test.py --server cpp,java --client nodejs
test/test.py --server nodejs --client cpp,java

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:

$ ./cpp/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)
  --named-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
  --protocol arg (=binary)    protocol: binary, compact, json
  --ssl                       Encrypted Transport using SSL
  --processor-events          processor-events
  -n [ --workers ] arg (=4)   Number of thread pools workers. Only valid for
                          thread-pool server type

Client command line interface:

$ ./cpp/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
  --named-pipe arg            Windows Named Pipe (e.g. MyThriftPipe)
  --anon-pipes hRead hWrite   Windows Anonymous Pipes pair (handles)
  --transport arg (=buffered) Transport: buffered, framed, http, evhttp
  --protocol arg (=binary)    Protocol: binary, compact, json
  --ssl                       Encrypted Transport using SSL
  -n [ --testloops ] arg (=1) Number of Tests
  -t [ --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 environemt 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