Add a test where client side sees a deadline expired status.

The test is not completely right and I filed [] to track it.
	Change on 2014/12/18 by yangg <yangg@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82442464
pull/1/merge
yangg 10 years ago committed by Michael Lumish
parent 336bf21127
commit da029e39b6
  1. 21
      test/cpp/end2end/end2end_test.cc

@ -157,6 +157,27 @@ TEST_F(End2endTest, MultipleRpcs) {
}
}
// Set a 10us deadline and make sure proper error is returned.
TEST_F(End2endTest, RpcDeadlineExpires) {
std::shared_ptr<ChannelInterface> channel =
CreateChannel(server_address_.str());
TestService::Stub* stub = TestService::NewStub(channel);
EchoRequest request;
EchoResponse response;
request.set_message("Hello");
ClientContext context;
std::chrono::system_clock::time_point deadline =
std::chrono::system_clock::now() + std::chrono::microseconds(10);
context.set_absolute_deadline(deadline);
Status s = stub->Echo(&context, request, &response);
// TODO(yangg) use correct error code when b/18793983 is fixed.
// EXPECT_EQ(StatusCode::DEADLINE_EXCEEDED, s.code());
EXPECT_EQ(StatusCode::CANCELLED, s.code());
delete stub;
}
TEST_F(End2endTest, UnimplementedRpc) {
std::shared_ptr<ChannelInterface> channel =
CreateChannel(server_address_.str());

Loading…
Cancel
Save