aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/security/credentials_test.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index 7043953154..2f8ffe4da6 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -46,6 +46,7 @@
#include "src/core/lib/http/httpcli.h"
#include "src/core/lib/security/credentials/composite/composite_credentials.h"
+#include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "src/core/lib/security/credentials/google_default/google_default_credentials.h"
#include "src/core/lib/security/credentials/jwt/jwt_credentials.h"
#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h"
@@ -411,7 +412,7 @@ static grpc_security_status check_channel_oauth2_create_security_connector(
static void test_channel_oauth2_composite_creds(void) {
grpc_channel_args *new_args;
grpc_channel_credentials_vtable vtable = {
- NULL, check_channel_oauth2_create_security_connector};
+ NULL, check_channel_oauth2_create_security_connector, NULL};
grpc_channel_credentials *channel_creds =
grpc_mock_channel_credentials_create(&vtable);
grpc_call_credentials *oauth2_creds =
@@ -495,7 +496,7 @@ check_channel_oauth2_google_iam_create_security_connector(
static void test_channel_oauth2_google_iam_composite_creds(void) {
grpc_channel_args *new_args;
grpc_channel_credentials_vtable vtable = {
- NULL, check_channel_oauth2_google_iam_create_security_connector};
+ NULL, check_channel_oauth2_google_iam_create_security_connector, NULL};
grpc_channel_credentials *channel_creds =
grpc_mock_channel_credentials_create(&vtable);
grpc_call_credentials *oauth2_creds =
@@ -1148,6 +1149,31 @@ static void test_get_well_known_google_credentials_file_path(void) {
#endif
}
+static void test_channel_creds_duplicate_without_call_creds(void) {
+ grpc_channel_credentials *channel_creds =
+ grpc_fake_transport_security_credentials_create();
+
+ grpc_channel_credentials *dup =
+ grpc_channel_credentials_duplicate_without_call_credentials(
+ channel_creds);
+ GPR_ASSERT(dup == channel_creds);
+ grpc_channel_credentials_unref(dup);
+
+ grpc_call_credentials *call_creds =
+ grpc_access_token_credentials_create("blah", NULL);
+ grpc_channel_credentials *composite_creds =
+ grpc_composite_channel_credentials_create(channel_creds, call_creds,
+ NULL);
+ grpc_call_credentials_unref(call_creds);
+ dup = grpc_channel_credentials_duplicate_without_call_credentials(
+ composite_creds);
+ GPR_ASSERT(dup == channel_creds);
+ grpc_channel_credentials_unref(dup);
+
+ grpc_channel_credentials_unref(channel_creds);
+ grpc_channel_credentials_unref(composite_creds);
+}
+
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
@@ -1182,6 +1208,7 @@ int main(int argc, char **argv) {
test_metadata_plugin_success();
test_metadata_plugin_failure();
test_get_well_known_google_credentials_file_path();
+ test_channel_creds_duplicate_without_call_creds();
grpc_shutdown();
return 0;
}