Update TlsServerCredentials to initialize C-core.

pull/22187/head
Matthew Stevenson 5 years ago
parent 5e98ad4077
commit 864e232edf
  1. 2
      src/cpp/server/secure_server_credentials.cc
  2. 2
      test/cpp/client/credentials_test.cc

@ -21,6 +21,7 @@
#include <memory> #include <memory>
#include <grpcpp/impl/codegen/slice.h> #include <grpcpp/impl/codegen/slice.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/auth_metadata_processor.h> #include <grpcpp/security/auth_metadata_processor.h>
#include "src/cpp/common/secure_auth_context.h" #include "src/cpp/common/secure_auth_context.h"
@ -149,6 +150,7 @@ std::shared_ptr<ServerCredentials> LocalServerCredentials(
std::shared_ptr<ServerCredentials> TlsServerCredentials( std::shared_ptr<ServerCredentials> TlsServerCredentials(
const TlsCredentialsOptions& options) { const TlsCredentialsOptions& options) {
grpc::GrpcLibraryCodegen init;
return std::shared_ptr<ServerCredentials>(new SecureServerCredentials( return std::shared_ptr<ServerCredentials>(new SecureServerCredentials(
grpc_tls_server_credentials_create(options.c_credentials_options()))); grpc_tls_server_credentials_create(options.c_credentials_options())));
} }

@ -682,7 +682,6 @@ TEST_F(CredentialsTest, LoadTlsChannelCredentials) {
// This test demonstrates how the TLS credentials will be used to create // This test demonstrates how the TLS credentials will be used to create
// server credentials. // server credentials.
TEST_F(CredentialsTest, LoadTlsServerCredentials) { TEST_F(CredentialsTest, LoadTlsServerCredentials) {
grpc_init();
std::shared_ptr<TestTlsCredentialReload> test_credential_reload( std::shared_ptr<TestTlsCredentialReload> test_credential_reload(
new TestTlsCredentialReload()); new TestTlsCredentialReload());
std::shared_ptr<TlsCredentialReloadConfig> credential_reload_config( std::shared_ptr<TlsCredentialReloadConfig> credential_reload_config(
@ -694,7 +693,6 @@ TEST_F(CredentialsTest, LoadTlsServerCredentials) {
std::shared_ptr<::grpc_impl::ServerCredentials> server_credentials = std::shared_ptr<::grpc_impl::ServerCredentials> server_credentials =
grpc::experimental::TlsServerCredentials(options); grpc::experimental::TlsServerCredentials(options);
GPR_ASSERT(server_credentials.get() != nullptr); GPR_ASSERT(server_credentials.get() != nullptr);
grpc_shutdown();
} }
TEST_F(CredentialsTest, TlsCredentialReloadConfigErrorMessages) { TEST_F(CredentialsTest, TlsCredentialReloadConfigErrorMessages) {

Loading…
Cancel
Save