diff options
author | yang-g <yangg@google.com> | 2015-09-21 10:32:17 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2015-09-21 10:32:17 -0700 |
commit | 78bddc66b74342c9a44a29fd3bb3f78548675eca (patch) | |
tree | ae2fd05f0f298b9392cb0d5e8e40904e741311cf /test | |
parent | 36a5551db44ce25729af4ac9296f0de21f6fcf84 (diff) |
Add empty_stream test case
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/interop/client.cc | 6 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.cc | 16 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.h | 1 |
3 files changed, 22 insertions, 1 deletions
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index ba44a918db..58c71cca35 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -68,6 +68,7 @@ DEFINE_string(test_case, "large_unary", "cancel_after_begin : cancel stream after starting it; " "cancel_after_first_response: cancel on first response; " "timeout_on_sleeping_server: deadline exceeds on stream; " + "empty_stream : bi-di stream with no request/response; " "compute_engine_creds: large_unary with compute engine auth; " "jwt_token_creds: large_unary with JWT token auth; " "oauth2_auth_token: raw oauth2 access token auth; " @@ -113,6 +114,8 @@ int main(int argc, char** argv) { client.DoCancelAfterFirstResponse(); } else if (FLAGS_test_case == "timeout_on_sleeping_server") { client.DoTimeoutOnSleepingServer(); + } else if (FLAGS_test_case == "empty_stream") { + client.DoEmptyStream(); } else if (FLAGS_test_case == "compute_engine_creds") { client.DoComputeEngineCreds(FLAGS_default_service_account, FLAGS_oauth_scope); @@ -137,6 +140,7 @@ int main(int argc, char** argv) { client.DoCancelAfterBegin(); client.DoCancelAfterFirstResponse(); client.DoTimeoutOnSleepingServer(); + client.DoEmptyStream(); client.DoStatusWithMessage(); // service_account_creds and jwt_token_creds can only run with ssl. if (FLAGS_enable_ssl) { @@ -153,7 +157,7 @@ int main(int argc, char** argv) { "Unsupported test case %s. Valid options are all|empty_unary|" "large_unary|large_compressed_unary|client_streaming|server_streaming|" "server_compressed_streaming|half_duplex|ping_pong|cancel_after_begin|" - "cancel_after_first_response|timeout_on_sleeping_server|" + "cancel_after_first_response|timeout_on_sleeping_server|empty_stream|" "compute_engine_creds|jwt_token_creds|oauth2_auth_token|per_rpc_creds", FLAGS_test_case.c_str()); ret = 1; diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 8124cae67a..02e10a50aa 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -554,6 +554,22 @@ void InteropClient::DoTimeoutOnSleepingServer() { gpr_log(GPR_INFO, "Pingpong streaming timeout done."); } +void InteropClient::DoEmptyStream() { + gpr_log(GPR_INFO, "Starting empty_stream."); + std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_)); + + ClientContext context; + std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, + StreamingOutputCallResponse>> + stream(stub->FullDuplexCall(&context)); + stream->WritesDone(); + StreamingOutputCallResponse response; + GPR_ASSERT(stream->Read(&response) == false); + Status s = stream->Finish(); + AssertOkOrPrintErrorStatus(s); + gpr_log(GPR_INFO, "empty_stream done."); +} + void InteropClient::DoStatusWithMessage() { gpr_log(GPR_INFO, "Sending RPC with a request for status code 2 and message"); std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_)); diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index 7bcb58571e..ebecd68c3f 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -62,6 +62,7 @@ class InteropClient { void DoCancelAfterBegin(); void DoCancelAfterFirstResponse(); void DoTimeoutOnSleepingServer(); + void DoEmptyStream(); void DoStatusWithMessage(); // Auth tests. // username is a string containing the user email |