aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/end2end
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-06-16 17:30:26 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-06-16 17:30:26 -0700
commit2622ddbcfd126fe78b46b4252157479cb1d11669 (patch)
tree266012bbd5c5baebdb623e75d5ecae78e8fb283e /test/cpp/end2end
parent029566623b76fb84072ebebd565db0c115cbee91 (diff)
parentb327c56bfba2a3e6c964c604b865bad8a8caba77 (diff)
Merge branch 'we-dont-need-no-backup' into one-shouldnt-depend-on-protobufs
Conflicts: include/grpc++/async_unary_call.h include/grpc++/config.h include/grpc++/config_protobuf.h include/grpc++/impl/service_type.h include/grpc++/stream.h src/cpp/common/call.cc
Diffstat (limited to 'test/cpp/end2end')
-rw-r--r--test/cpp/end2end/async_end2end_test.cc18
-rw-r--r--test/cpp/end2end/client_crash_test.cc4
-rw-r--r--test/cpp/end2end/end2end_test.cc68
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc4
-rw-r--r--test/cpp/end2end/mock_test.cc4
-rw-r--r--test/cpp/end2end/thread_stress_test.cc6
6 files changed, 52 insertions, 52 deletions
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 507fc7a710..117d8bb9fa 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -167,7 +167,7 @@ class AsyncEnd2endTest : public ::testing::Test {
Verifier().Expect(4, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
}
@@ -227,7 +227,7 @@ TEST_F(AsyncEnd2endTest, AsyncNextRpc) {
Verifier().Expect(4, true).Verify(cq_.get(), std::chrono::system_clock::time_point::max());
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
// Two pings and a final pong.
@@ -280,7 +280,7 @@ TEST_F(AsyncEnd2endTest, SimpleClientStreaming) {
Verifier().Expect(10, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
// One ping, two pongs.
@@ -330,7 +330,7 @@ TEST_F(AsyncEnd2endTest, SimpleServerStreaming) {
cli_stream->Finish(&recv_status, tag(9));
Verifier().Expect(9, true).Verify(cq_.get());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
// One ping, one pong.
@@ -382,7 +382,7 @@ TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) {
cli_stream->Finish(&recv_status, tag(10));
Verifier().Expect(10, true).Verify(cq_.get());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
// Metadata tests
@@ -426,7 +426,7 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) {
Verifier().Expect(4, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) {
@@ -473,7 +473,7 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) {
Verifier().Expect(6, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) {
@@ -513,7 +513,7 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) {
response_reader->Finish(&recv_response, &recv_status, tag(5));
Verifier().Expect(5, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata();
EXPECT_EQ(meta1.second, server_trailing_metadata.find(meta1.first)->second);
EXPECT_EQ(meta2.second, server_trailing_metadata.find(meta2.first)->second);
@@ -586,7 +586,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) {
response_reader->Finish(&recv_response, &recv_status, tag(6));
Verifier().Expect(6, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata();
EXPECT_EQ(meta5.second, server_trailing_metadata.find(meta5.first)->second);
EXPECT_EQ(meta6.second, server_trailing_metadata.find(meta6.first)->second);
diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc
index 7b90fcaec1..7876e8dee3 100644
--- a/test/cpp/end2end/client_crash_test.cc
+++ b/test/cpp/end2end/client_crash_test.cc
@@ -118,7 +118,7 @@ TEST_F(CrashTest, KillBeforeWrite) {
// But the read will definitely fail
EXPECT_FALSE(stream->Read(&response));
- EXPECT_FALSE(stream->Finish().IsOk());
+ EXPECT_FALSE(stream->Finish().ok());
}
TEST_F(CrashTest, KillAfterWrite) {
@@ -142,7 +142,7 @@ TEST_F(CrashTest, KillAfterWrite) {
EXPECT_FALSE(stream->Read(&response));
- EXPECT_FALSE(stream->Finish().IsOk());
+ EXPECT_FALSE(stream->Finish().ok());
}
} // namespace
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index f48cf953a4..45ba8b0878 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -101,13 +101,13 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
gpr_now(),
gpr_time_from_micros(request->param().client_cancel_after_us())));
}
- return Status::Cancelled;
+ return Status::CANCELLED;
} else if (request->has_param() &&
request->param().server_cancel_after_us()) {
gpr_sleep_until(gpr_time_add(
gpr_now(),
gpr_time_from_micros(request->param().server_cancel_after_us())));
- return Status::Cancelled;
+ return Status::CANCELLED;
} else {
EXPECT_FALSE(context->IsCancelled());
}
@@ -232,7 +232,7 @@ static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub,
ClientContext context;
Status s = stub->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
}
@@ -265,7 +265,7 @@ TEST_F(End2endTest, RpcDeadlineExpires) {
std::chrono::system_clock::now() + std::chrono::microseconds(10);
context.set_deadline(deadline);
Status s = stub_->Echo(&context, request, &response);
- EXPECT_EQ(StatusCode::DEADLINE_EXCEEDED, s.code());
+ EXPECT_EQ(StatusCode::DEADLINE_EXCEEDED, s.error_code());
}
// Set a long but finite deadline.
@@ -281,7 +281,7 @@ TEST_F(End2endTest, RpcLongDeadline) {
context.set_deadline(deadline);
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
// Ask server to echo back the deadline it sees.
@@ -298,7 +298,7 @@ TEST_F(End2endTest, EchoDeadline) {
context.set_deadline(deadline);
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
gpr_timespec sent_deadline;
Timepoint2Timespec(deadline, &sent_deadline);
// Allow 1 second error.
@@ -317,7 +317,7 @@ TEST_F(End2endTest, EchoDeadlineForNoDeadlineRpc) {
ClientContext context;
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
EXPECT_EQ(response.param().request_deadline(), gpr_inf_future.tv_sec);
}
@@ -329,9 +329,9 @@ TEST_F(End2endTest, UnimplementedRpc) {
ClientContext context;
Status s = stub_->Unimplemented(&context, request, &response);
- EXPECT_FALSE(s.IsOk());
- EXPECT_EQ(s.code(), grpc::StatusCode::UNIMPLEMENTED);
- EXPECT_EQ(s.details(), "");
+ EXPECT_FALSE(s.ok());
+ EXPECT_EQ(s.error_code(), grpc::StatusCode::UNIMPLEMENTED);
+ EXPECT_EQ(s.error_message(), "");
EXPECT_EQ(response.message(), "");
}
@@ -347,7 +347,7 @@ TEST_F(End2endTest, RequestStreamOneRequest) {
stream->WritesDone();
Status s = stream->Finish();
EXPECT_EQ(response.message(), request.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
TEST_F(End2endTest, RequestStreamTwoRequests) {
@@ -363,7 +363,7 @@ TEST_F(End2endTest, RequestStreamTwoRequests) {
stream->WritesDone();
Status s = stream->Finish();
EXPECT_EQ(response.message(), "hellohello");
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
TEST_F(End2endTest, ResponseStream) {
@@ -383,7 +383,7 @@ TEST_F(End2endTest, ResponseStream) {
EXPECT_FALSE(stream->Read(&response));
Status s = stream->Finish();
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
TEST_F(End2endTest, BidiStream) {
@@ -414,7 +414,7 @@ TEST_F(End2endTest, BidiStream) {
EXPECT_FALSE(stream->Read(&response));
Status s = stream->Finish();
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
// Talk to the two services with the same name but different package names.
@@ -433,7 +433,7 @@ TEST_F(End2endTest, DiffPackageServices) {
ClientContext context;
Status s = stub->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
std::unique_ptr<grpc::cpp::test::util::duplicate::TestService::Stub>
dup_pkg_stub(
@@ -441,7 +441,7 @@ TEST_F(End2endTest, DiffPackageServices) {
ClientContext context2;
s = dup_pkg_stub->Echo(&context2, request, &response);
EXPECT_EQ("no package", response.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
// rpc and stream should fail on bad credentials.
@@ -459,16 +459,16 @@ TEST_F(End2endTest, BadCredentials) {
Status s = stub->Echo(&context, request, &response);
EXPECT_EQ("", response.message());
- EXPECT_FALSE(s.IsOk());
- EXPECT_EQ(StatusCode::UNKNOWN, s.code());
- EXPECT_EQ("Rpc sent on a lame channel.", s.details());
+ EXPECT_FALSE(s.ok());
+ EXPECT_EQ(StatusCode::UNKNOWN, s.error_code());
+ EXPECT_EQ("Rpc sent on a lame channel.", s.error_message());
ClientContext context2;
auto stream = stub->BidiStream(&context2);
s = stream->Finish();
- EXPECT_FALSE(s.IsOk());
- EXPECT_EQ(StatusCode::UNKNOWN, s.code());
- EXPECT_EQ("Rpc sent on a lame channel.", s.details());
+ EXPECT_FALSE(s.ok());
+ EXPECT_EQ(StatusCode::UNKNOWN, s.error_code());
+ EXPECT_EQ("Rpc sent on a lame channel.", s.error_message());
}
void CancelRpc(ClientContext* context, int delay_us, TestServiceImpl* service) {
@@ -491,8 +491,8 @@ TEST_F(End2endTest, ClientCancelsRpc) {
std::thread cancel_thread(CancelRpc, &context, kCancelDelayUs, &service_);
Status s = stub_->Echo(&context, request, &response);
cancel_thread.join();
- EXPECT_EQ(StatusCode::CANCELLED, s.code());
- EXPECT_EQ(s.details(), "Cancelled");
+ EXPECT_EQ(StatusCode::CANCELLED, s.error_code());
+ EXPECT_EQ(s.error_message(), "Cancelled");
}
// Server cancels rpc after 1ms
@@ -505,8 +505,8 @@ TEST_F(End2endTest, ServerCancelsRpc) {
ClientContext context;
Status s = stub_->Echo(&context, request, &response);
- EXPECT_EQ(StatusCode::CANCELLED, s.code());
- EXPECT_TRUE(s.details().empty());
+ EXPECT_EQ(StatusCode::CANCELLED, s.error_code());
+ EXPECT_TRUE(s.error_message().empty());
}
// Client cancels request stream after sending two messages
@@ -524,7 +524,7 @@ TEST_F(End2endTest, ClientCancelsRequestStream) {
context.TryCancel();
Status s = stream->Finish();
- EXPECT_EQ(grpc::StatusCode::CANCELLED, s.code());
+ EXPECT_EQ(grpc::StatusCode::CANCELLED, s.error_code());
EXPECT_EQ(response.message(), "");
}
@@ -558,7 +558,7 @@ TEST_F(End2endTest, ClientCancelsResponseStream) {
Status s = stream->Finish();
// The final status could be either of CANCELLED or OK depending on
// who won the race.
- EXPECT_GE(grpc::StatusCode::CANCELLED, s.code());
+ EXPECT_GE(grpc::StatusCode::CANCELLED, s.error_code());
}
// Client cancels bidi stream after sending some messages
@@ -591,7 +591,7 @@ TEST_F(End2endTest, ClientCancelsBidi) {
}
Status s = stream->Finish();
- EXPECT_EQ(grpc::StatusCode::CANCELLED, s.code());
+ EXPECT_EQ(grpc::StatusCode::CANCELLED, s.error_code());
}
TEST_F(End2endTest, RpcMaxMessageSize) {
@@ -602,7 +602,7 @@ TEST_F(End2endTest, RpcMaxMessageSize) {
ClientContext context;
Status s = stub_->Echo(&context, request, &response);
- EXPECT_FALSE(s.IsOk());
+ EXPECT_FALSE(s.ok());
}
bool MetadataContains(const std::multimap<grpc::string, grpc::string>& metadata,
@@ -632,7 +632,7 @@ TEST_F(End2endTest, SetPerCallCredentials) {
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(request.message(), response.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
EXPECT_TRUE(MetadataContains(context.GetServerTrailingMetadata(),
GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY,
"fake_token"));
@@ -652,8 +652,8 @@ TEST_F(End2endTest, InsecurePerCallCredentials) {
request.mutable_param()->set_echo_metadata(true);
Status s = stub_->Echo(&context, request, &response);
- EXPECT_EQ(StatusCode::CANCELLED, s.code());
- EXPECT_EQ("Failed to set credentials to rpc.", s.details());
+ EXPECT_EQ(StatusCode::CANCELLED, s.error_code());
+ EXPECT_EQ("Failed to set credentials to rpc.", s.error_message());
}
TEST_F(End2endTest, OverridePerCallCredentials) {
@@ -684,7 +684,7 @@ TEST_F(End2endTest, OverridePerCallCredentials) {
GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY,
"fake_selector1"));
EXPECT_EQ(request.message(), response.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
} // namespace testing
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index 5a26834df9..b9d47b32de 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -190,7 +190,7 @@ class GenericEnd2endTest : public ::testing::Test {
client_ok(9);
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
}
@@ -273,7 +273,7 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) {
client_ok(10);
EXPECT_EQ(send_response.message(), recv_response.message());
- EXPECT_TRUE(recv_status.IsOk());
+ EXPECT_TRUE(recv_status.ok());
}
} // namespace
diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc
index 0226da672c..2809ab8d3c 100644
--- a/test/cpp/end2end/mock_test.cc
+++ b/test/cpp/end2end/mock_test.cc
@@ -168,7 +168,7 @@ class FakeClient {
request.set_message("hello world");
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(request.message(), response.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
void DoBidiStream() {
@@ -199,7 +199,7 @@ class FakeClient {
EXPECT_FALSE(stream->Read(&response));
Status s = stream->Finish();
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
void ResetStub(TestService::StubInterface* stub) { stub_ = stub; }
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index 5ee29e40f4..0b43dfd106 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -99,13 +99,13 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
gpr_now(),
gpr_time_from_micros(request->param().client_cancel_after_us())));
}
- return Status::Cancelled;
+ return Status::CANCELLED;
} else if (request->has_param() &&
request->param().server_cancel_after_us()) {
gpr_sleep_until(gpr_time_add(
gpr_now(),
gpr_time_from_micros(request->param().server_cancel_after_us())));
- return Status::Cancelled;
+ return Status::CANCELLED;
} else {
EXPECT_FALSE(context->IsCancelled());
}
@@ -219,7 +219,7 @@ static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub,
ClientContext context;
Status s = stub->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
- EXPECT_TRUE(s.IsOk());
+ EXPECT_TRUE(s.ok());
}
}