From 2c7caa10f468ec3ed38f850c91cbf6b213ebf4a4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 17 Jun 2016 11:46:47 -0700 Subject: [PATCH 1/5] update third_party/protobuf to v3.0.0-beta-3.2 --- third_party/protobuf | 2 +- tools/run_tests/sanity/check_submodules.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/protobuf b/third_party/protobuf index 3470b6895aa..d4d13a4349e 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 3470b6895aa659b7559ed678e029a5338e535f14 +Subproject commit d4d13a4349e4e59d67f311185ddcc1890d956d7a diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 6e858fa9c92..f2d7a1429ea 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -41,11 +41,11 @@ want_submodules=`mktemp /tmp/submXXXXXX` git submodule | awk '{ print $1 }' | sort > $submodules cat << EOF | awk '{ print $1 }' | sort > $want_submodules - c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9 third_party/boringssl (heads/2661) + c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9 third_party/boringssl (version_for_cocoapods_2.0-100-gc880e42) 05b155ff59114735ec8cd089f669c4c3d8f59029 third_party/gflags (v2.1.0-45-g05b155f) c99458533a9b4c743ed51537e25989ea55944908 third_party/googletest (release-1.7.0) f8ac463766281625ad710900479130c7fcb4d63b third_party/nanopb (nanopb-0.3.4-29-gf8ac463) - 3470b6895aa659b7559ed678e029a5338e535f14 third_party/protobuf (v3.0.0-beta-2-441-g3470b68) + d4d13a4349e4e59d67f311185ddcc1890d956d7a third_party/protobuf (v3.0.0-beta-3.2) 50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8) EOF From e2e08735e5226195ed3706bc10a9d297dd88bdf0 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Wed, 18 May 2016 14:37:20 -0700 Subject: [PATCH 2/5] php: implement custom_metadata interop test --- src/php/tests/interop/interop_client.php | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index c5bb7c490e2..e3c234e8695 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -388,6 +388,64 @@ function timeoutOnSleepingServer($stub) 'Call status was not DEADLINE_EXCEEDED'); } +function customMetadata($stub) +{ + $ECHO_INITIAL_KEY = 'x-grpc-test-echo-initial'; + $ECHO_INITIAL_VALUE = 'test_initial_metadata_value'; + $ECHO_TRAILING_KEY = 'x-grpc-test-echo-trailing-bin'; + $ECHO_TRAILING_VALUE = 'ababab'; + $request_len = 271828; + $response_len = 314159; + + $request = new grpc\testing\SimpleRequest(); + $request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE); + $request->setResponseSize($response_len); + $payload = new grpc\testing\Payload(); + $payload->setType(grpc\testing\PayloadType::COMPRESSABLE); + $payload->setBody(str_repeat("\0", $request_len)); + $request->setPayload($payload); + + $metadata = [ + $ECHO_INITIAL_KEY => [$ECHO_INITIAL_VALUE], + $ECHO_TRAILING_KEY => [$ECHO_TRAILING_VALUE], + ]; + $call = $stub->UnaryCall($request, $metadata); + + $initial_metadata = $call->getMetadata(); + hardAssert(array_key_exists($ECHO_INITIAL_KEY, $initial_metadata), + 'Initial metadata does not contain expected key'); + hardAssert($initial_metadata[$ECHO_INITIAL_KEY][0] == + $ECHO_INITIAL_VALUE, + 'Incorrect initial metadata value'); + + list($result, $status) = $call->wait(); + hardAssert($status->code === Grpc\STATUS_OK, + 'Call did not complete successfully'); + + $trailing_metadata = $call->getTrailingMetadata(); + hardAssert(array_key_exists($ECHO_TRAILING_KEY, $trailing_metadata), + 'Trailing metadata does not contain expected key'); + hardAssert($trailing_metadata[$ECHO_TRAILING_KEY][0] == + $ECHO_TRAILING_VALUE, 'Incorrect trailing metadata value'); + + $streaming_call = $stub->FullDuplexCall($metadata); + + $streaming_request = new grpc\testing\StreamingOutputCallRequest(); + $streaming_request->setPayload($payload); + $streaming_call->write($streaming_request); + $streaming_call->writesDone(); + + hardAssert($streaming_call->getStatus()->code === Grpc\STATUS_OK, + 'Call did not complete successfully'); + + $streaming_trailing_metadata = $streaming_call->getTrailingMetadata(); + hardAssert(array_key_exists($ECHO_TRAILING_KEY, + $streaming_trailing_metadata), + 'Trailing metadata does not contain expected key'); + hardAssert($streaming_trailing_metadata[$ECHO_TRAILING_KEY][0] == + $ECHO_TRAILING_VALUE, 'Incorrect trailing metadata value'); +} + function _makeStub($args) { if (!array_key_exists('server_host', $args)) { @@ -514,6 +572,9 @@ function interop_main($args, $stub = false) case 'timeout_on_sleeping_server': timeoutOnSleepingServer($stub); break; + case 'custom_metadata': + customMetadata($stub); + break; case 'service_account_creds': serviceAccountCreds($stub, $args); break; From 89391406cddd8f0ff89992835d89baa716465447 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Fri, 17 Jun 2016 11:20:19 -0700 Subject: [PATCH 3/5] php: implement 2 more interop tests --- src/php/tests/interop/interop_client.php | 45 ++++++++++++++++++++++++ src/php/tests/interop/messages.proto | 38 +++++++++++++++++--- src/php/tests/interop/test.proto | 3 ++ 3 files changed, 82 insertions(+), 4 deletions(-) diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index e3c234e8695..92a27d17aad 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -446,6 +446,45 @@ function customMetadata($stub) $ECHO_TRAILING_VALUE, 'Incorrect trailing metadata value'); } +function statusCodeAndMessage($stub) +{ + $echo_status = new grpc\testing\EchoStatus(); + $echo_status->setCode(2); + $echo_status->setMessage("test status message"); + + $request = new grpc\testing\SimpleRequest(); + $request->setResponseStatus($echo_status); + + $call = $stub->UnaryCall($request); + list($result, $status) = $call->wait(); + + hardAssert($status->code === 2, + 'Received unexpected status code'); + hardAssert($status->details === "test status message", + 'Received unexpected status details'); + + $streaming_call = $stub->FullDuplexCall(); + + $streaming_request = new grpc\testing\StreamingOutputCallRequest(); + $streaming_request->setResponseStatus($echo_status); + $streaming_call->write($streaming_request); + $streaming_call->writesDone(); + + $status = $streaming_call->getStatus(); + hardAssert($status->code === 2, + 'Received unexpected status code'); + hardAssert($status->details === "test status message", + 'Received unexpected status details'); +} + +function unimplementedMethod($stub) +{ + $call = $stub->UnimplementedCall(new grpc\testing\EmptyMessage()); + list($result, $status) = $call->wait(); + hardAssert($status->code === Grpc\STATUS_UNIMPLEMENTED, + 'Received unexpected status code'); +} + function _makeStub($args) { if (!array_key_exists('server_host', $args)) { @@ -575,6 +614,12 @@ function interop_main($args, $stub = false) case 'custom_metadata': customMetadata($stub); break; + case 'status_code_and_message': + statusCodeAndMessage($stub); + break; + case 'unimplemented_method': + unimplementedMethod($stub); + break; case 'service_account_creds': serviceAccountCreds($stub, $args); break; diff --git a/src/php/tests/interop/messages.proto b/src/php/tests/interop/messages.proto index de0b1a23205..44e3c3b8f97 100644 --- a/src/php/tests/interop/messages.proto +++ b/src/php/tests/interop/messages.proto @@ -1,5 +1,5 @@ -// Copyright 2015, Google Inc. +// Copyright 2015-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -41,9 +41,6 @@ enum PayloadType { // Uncompressable binary format. UNCOMPRESSABLE = 1; - - // Randomly chosen from all other formats defined in this enum. - RANDOM = 2; } // A block of data, to simply increase gRPC message size. @@ -54,6 +51,13 @@ message Payload { optional bytes body = 2; } +// A protobuf representation for grpc status. This is used by test +// clients to specify a status that the server should attempt to return. +message EchoStatus { + optional int32 code = 1; + optional string message = 2; +} + // Unary request. message SimpleRequest { // Desired payload type in the response from the server. @@ -72,6 +76,12 @@ message SimpleRequest { // Whether SimpleResponse should include OAuth scope. optional bool fill_oauth_scope = 5; + + // Whether to request the server to compress the response. + optional bool request_compressed_response = 6; + + // Whether server should return a given status + optional EchoStatus response_status = 7; } // Unary response, as configured by the request. @@ -123,6 +133,12 @@ message StreamingOutputCallRequest { // Optional input payload sent along with the request. optional Payload payload = 3; + + // Whether to request the server to compress the response. + optional bool request_compressed_response = 6; + + // Whether server should return a given status + optional EchoStatus response_status = 7; } // Server-streaming response, as configured by the request and parameters. @@ -130,3 +146,17 @@ message StreamingOutputCallResponse { // Payload to increase response size. optional Payload payload = 1; } + +// For reconnect interop test only. +// Client tells server what reconnection parameters it used. +message ReconnectParams { + optional int32 max_reconnect_backoff_ms = 1; +} + +// For reconnect interop test only. +// Server tells client whether its reconnects are following the spec and the +// reconnect backoffs it saw. +message ReconnectInfo { + optional bool passed = 1; + repeated int32 backoff_ms = 2; +} diff --git a/src/php/tests/interop/test.proto b/src/php/tests/interop/test.proto index 0d169e7f640..da03237a936 100644 --- a/src/php/tests/interop/test.proto +++ b/src/php/tests/interop/test.proto @@ -68,4 +68,7 @@ service TestService { // first request. rpc HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse); + + // An unimplemented method on the server + rpc UnimplementedCall(grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage); } From 83d8e3740e28080c4dff1e3660a4f2a1b843ce14 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Fri, 17 Jun 2016 11:53:33 -0700 Subject: [PATCH 4/5] php: run advanced interop tests --- tools/run_tests/run_interop_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 5aaefb1ae14..0787637d758 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -252,7 +252,7 @@ class PHPLanguage: return {} def unimplemented_test_cases(self): - return _SKIP_ADVANCED + _SKIP_COMPRESSION + return _SKIP_COMPRESSION def unimplemented_test_cases_server(self): return [] From a66e075144fe3219ea2bf0371e502286c51ddebc Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Fri, 17 Jun 2016 13:06:36 -0700 Subject: [PATCH 5/5] php: there is an unimplemented service --- src/php/tests/interop/interop_client.php | 6 +++++- src/php/tests/interop/test.proto | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index 92a27d17aad..43b3199d92c 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -569,7 +569,11 @@ function _makeStub($args) $opts['update_metadata'] = $update_metadata; } - $stub = new grpc\testing\TestServiceClient($server_address, $opts); + if ($test_case == 'unimplemented_method') { + $stub = new grpc\testing\UnimplementedServiceClient($server_address, $opts); + } else { + $stub = new grpc\testing\TestServiceClient($server_address, $opts); + } return $stub; } diff --git a/src/php/tests/interop/test.proto b/src/php/tests/interop/test.proto index da03237a936..57ef30ee1c1 100644 --- a/src/php/tests/interop/test.proto +++ b/src/php/tests/interop/test.proto @@ -1,5 +1,5 @@ -// Copyright 2015, Google Inc. +// Copyright 2015-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -68,7 +68,11 @@ service TestService { // first request. rpc HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse); +} - // An unimplemented method on the server +// A simple service NOT implemented at servers so clients can test for +// that case. +service UnimplementedService { + // A call that no server should implement rpc UnimplementedCall(grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage); }