|
|
@ -246,20 +246,26 @@ typedef void (*grpcpp_tls_on_credential_reload_done_cb)( |
|
|
|
|
|
|
|
|
|
|
|
TEST_F(CredentialsTest, TlsCredentialReloadArgCppToC) { |
|
|
|
TEST_F(CredentialsTest, TlsCredentialReloadArgCppToC) { |
|
|
|
TlsCredentialReloadArg arg; |
|
|
|
TlsCredentialReloadArg arg; |
|
|
|
// Only sync credential reload supported currently,
|
|
|
|
|
|
|
|
// so we use a nullptr call back function.
|
|
|
|
|
|
|
|
arg.set_cb(static_cast<grpcpp_tls_on_credential_reload_done_cb>(nullptr)); |
|
|
|
arg.set_cb(static_cast<grpcpp_tls_on_credential_reload_done_cb>(nullptr)); |
|
|
|
arg.set_cb_user_data(nullptr); |
|
|
|
arg.set_cb_user_data(nullptr); |
|
|
|
arg.set_key_materials_config( |
|
|
|
::std::shared_ptr<TlsKeyMaterialsConfig> key_materials_config; |
|
|
|
static_cast<::std::shared_ptr<TlsKeyMaterialsConfig>>(nullptr)); |
|
|
|
struct TlsKeyMaterialsConfig::PemKeyCertPair pair1 = {"private_key1", |
|
|
|
|
|
|
|
"cert_chain1"}; |
|
|
|
|
|
|
|
struct TlsKeyMaterialsConfig::PemKeyCertPair pair2 = {"private_key2", "cert_chain2"}; |
|
|
|
|
|
|
|
::std::vector<TlsKeyMaterialsConfig::PemKeyCertPair> pair_list = {pair1, pair2}; |
|
|
|
|
|
|
|
key_materials_config->set_key_materials("pem_root_certs", pair_list); |
|
|
|
|
|
|
|
arg.set_key_materials_config(key_materials_config); |
|
|
|
arg.set_status(GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW); |
|
|
|
arg.set_status(GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW); |
|
|
|
arg.set_error_details("error_details"); |
|
|
|
arg.set_error_details("error_details"); |
|
|
|
grpc_tls_credential_reload_arg* c_arg = arg.c_credential_reload_arg(); |
|
|
|
grpc_tls_credential_reload_arg* c_arg = arg.c_credential_reload_arg(); |
|
|
|
EXPECT_EQ(c_arg->cb, |
|
|
|
EXPECT_EQ(c_arg->cb, |
|
|
|
static_cast<grpc_tls_on_credential_reload_done_cb>(nullptr)); |
|
|
|
static_cast<grpc_tls_on_credential_reload_done_cb>(nullptr)); |
|
|
|
EXPECT_EQ(c_arg->cb_user_data, nullptr); |
|
|
|
EXPECT_EQ(c_arg->cb_user_data, nullptr); |
|
|
|
EXPECT_EQ(c_arg->key_materials_config, |
|
|
|
EXPECT_EQ(c_arg->key_materials_config->pem_root_certs(), "pem_root_certs"); |
|
|
|
static_cast<::std::shared_ptr<TlsKeyMaterialsConfig>>(nullptr)); |
|
|
|
EXPECT_EQ(c_arg->key_materials_config->pem_key_cert_pair_list()[0].private_key(), "private_key1"); |
|
|
|
|
|
|
|
EXPECT_EQ(c_arg->key_materials_config->pem_key_cert_pair_list()[1].private_key(), "private_key2"); |
|
|
|
|
|
|
|
EXPECT_EQ(c_arg->key_materials_config->pem_key_cert_pair_list()[0].cert_chain(), "cert_chain1"); |
|
|
|
|
|
|
|
EXPECT_EQ(c_arg->key_materials_config->pem_key_cert_pair_list()[1].cert_chain(), "cert_chain2"); |
|
|
|
EXPECT_EQ(c_arg->status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW); |
|
|
|
EXPECT_EQ(c_arg->status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW); |
|
|
|
EXPECT_STREQ(c_arg->error_details, "error_details"); |
|
|
|
EXPECT_STREQ(c_arg->error_details, "error_details"); |
|
|
|
} |
|
|
|
} |
|
|
|