aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/end2end/async_end2end_test.cc4
-rw-r--r--test/cpp/end2end/end2end_test.cc29
-rw-r--r--test/cpp/util/create_test_channel.cc2
3 files changed, 11 insertions, 24 deletions
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 248e054e49..9e25a5308d 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -105,8 +105,8 @@ class AsyncEnd2endTest : public ::testing::Test {
void ResetStub() {
std::shared_ptr<ChannelInterface> channel =
- CreateChannel(server_address_.str(), ChannelArguments());
- stub_.reset(grpc::cpp::test::util::TestService::NewStub(channel));
+ CreateChannelDeprecated(server_address_.str(), ChannelArguments());
+ stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
void server_ok(int i) {
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index d4ca3ef49e..45f12a9e9d 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -161,8 +161,8 @@ class End2endTest : public ::testing::Test {
void ResetStub() {
std::shared_ptr<ChannelInterface> channel =
- CreateChannel(server_address_.str(), ChannelArguments());
- stub_.reset(grpc::cpp::test::util::TestService::NewStub(channel));
+ CreateChannelDeprecated(server_address_.str(), ChannelArguments());
+ stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
@@ -292,15 +292,13 @@ TEST_F(End2endTest, RequestStreamOneRequest) {
EchoResponse response;
ClientContext context;
- ClientWriter<EchoRequest>* stream = stub_->RequestStream(&context, &response);
+ auto stream = stub_->RequestStream(&context, &response);
request.set_message("hello");
EXPECT_TRUE(stream->Write(request));
stream->WritesDone();
Status s = stream->Finish();
EXPECT_EQ(response.message(), request.message());
EXPECT_TRUE(s.IsOk());
-
- delete stream;
}
TEST_F(End2endTest, RequestStreamTwoRequests) {
@@ -309,7 +307,7 @@ TEST_F(End2endTest, RequestStreamTwoRequests) {
EchoResponse response;
ClientContext context;
- ClientWriter<EchoRequest>* stream = stub_->RequestStream(&context, &response);
+ auto stream = stub_->RequestStream(&context, &response);
request.set_message("hello");
EXPECT_TRUE(stream->Write(request));
EXPECT_TRUE(stream->Write(request));
@@ -317,8 +315,6 @@ TEST_F(End2endTest, RequestStreamTwoRequests) {
Status s = stream->Finish();
EXPECT_EQ(response.message(), "hellohello");
EXPECT_TRUE(s.IsOk());
-
- delete stream;
}
TEST_F(End2endTest, ResponseStream) {
@@ -328,8 +324,7 @@ TEST_F(End2endTest, ResponseStream) {
ClientContext context;
request.set_message("hello");
- ClientReader<EchoResponse>* stream =
- stub_->ResponseStream(&context, request);
+ auto stream = stub_->ResponseStream(&context, request);
EXPECT_TRUE(stream->Read(&response));
EXPECT_EQ(response.message(), request.message() + "0");
EXPECT_TRUE(stream->Read(&response));
@@ -340,8 +335,6 @@ TEST_F(End2endTest, ResponseStream) {
Status s = stream->Finish();
EXPECT_TRUE(s.IsOk());
-
- delete stream;
}
TEST_F(End2endTest, BidiStream) {
@@ -351,8 +344,7 @@ TEST_F(End2endTest, BidiStream) {
ClientContext context;
grpc::string msg("hello");
- ClientReaderWriter<EchoRequest, EchoResponse>* stream =
- stub_->BidiStream(&context);
+ auto stream = stub_->BidiStream(&context);
request.set_message(msg + "0");
EXPECT_TRUE(stream->Write(request));
@@ -374,15 +366,13 @@ TEST_F(End2endTest, BidiStream) {
Status s = stream->Finish();
EXPECT_TRUE(s.IsOk());
-
- delete stream;
}
// Talk to the two services with the same name but different package names.
// The two stubs are created on the same channel.
TEST_F(End2endTest, DiffPackageServices) {
std::shared_ptr<ChannelInterface> channel =
- CreateChannel(server_address_.str(), ChannelArguments());
+ CreateChannelDeprecated(server_address_.str(), ChannelArguments());
EchoRequest request;
EchoResponse response;
@@ -426,14 +416,11 @@ TEST_F(End2endTest, BadCredentials) {
EXPECT_EQ("Rpc sent on a lame channel.", s.details());
ClientContext context2;
- ClientReaderWriter<EchoRequest, EchoResponse>* stream =
- stub->BidiStream(&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());
-
- delete stream;
}
} // namespace testing
diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc
index 99b3c2ecd4..745496f463 100644
--- a/test/cpp/util/create_test_channel.cc
+++ b/test/cpp/util/create_test_channel.cc
@@ -79,7 +79,7 @@ std::shared_ptr<ChannelInterface> CreateTestChannel(
}
return CreateChannel(connect_to, channel_creds, channel_args);
} else {
- return CreateChannel(server, channel_args);
+ return CreateChannelDeprecated(server, channel_args);
}
}