diff options
-rw-r--r-- | src/cpp/client/insecure_credentials.cc | 3 | ||||
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 668ea2e873..5ad8784567 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -52,7 +52,8 @@ class InsecureCredentialsImpl GRPC_FINAL : public Credentials { target, grpc_channel_create(target.c_str(), &channel_args))); } - bool ApplyToCall(grpc_call* call) GRPC_OVERRIDE { return true; } + // InsecureCredentials should not be applied to a call. + bool ApplyToCall(grpc_call* call) GRPC_OVERRIDE { return false; } SecureCredentials* AsSecureCredentials() GRPC_OVERRIDE { return nullptr; } }; diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index a98d7c23b9..d425c2e04c 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -614,8 +614,8 @@ TEST_F(End2endTest, InsecurePerCallCredentials) { grpc::string msg("Hello"); Status s = stub_->Echo(&context, request, &response); - EXPECT_EQ(request.message(), response.message()); - EXPECT_TRUE(s.IsOk()); + EXPECT_EQ(StatusCode::CANCELLED, s.code()); + EXPECT_EQ("Failed to set credentials to rpc.", s.details()); } TEST_F(End2endTest, OverridePerCallCredentials) { @@ -623,7 +623,7 @@ TEST_F(End2endTest, OverridePerCallCredentials) { EchoRequest request; EchoResponse response; ClientContext context; - std::shared_ptr<Credentials> creds1 = InsecureCredentials(); + std::shared_ptr<Credentials> creds1 = SslCredentials(SslCredentialsOptions()); context.set_credentials(creds1); std::shared_ptr<Credentials> creds2 = IAMCredentials("fake_token", "fake_selector"); |