aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/security/credentials_test.c
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2015-12-10 14:44:35 -0800
committerGravatar Julien Boeuf <jboeuf@google.com>2015-12-10 14:44:35 -0800
commit331e3782af23388a87d34c818ae205d15dacba1f (patch)
treeb4c90ddad674cbf76cb1a2e6267f270316bd50fb /test/core/security/credentials_test.c
parent07c4b573cff8de30e25e76f96617019d2199961a (diff)
Testing cached google default creds.
Diffstat (limited to 'test/core/security/credentials_test.c')
-rw-r--r--test/core/security/credentials_test.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index 5eb6118057..40a2332a11 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -917,6 +917,7 @@ static char *null_well_known_creds_path_getter(void) {
static void test_google_default_creds_gce(void) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_composite_channel_credentials *creds;
+ grpc_channel_credentials *cached_creds;
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
grpc_flush_cached_google_default_credentials();
@@ -942,7 +943,13 @@ static void test_google_default_creds_gce(void) {
grpc_exec_ctx_flush(&exec_ctx);
grpc_exec_ctx_finish(&exec_ctx);
+ /* Check that we get a cached creds if we call
+ grpc_google_default_credentials_create again. */
+ cached_creds = grpc_google_default_credentials_create();
+ GPR_ASSERT(cached_creds == &creds->base);
+
/* Cleanup. */
+ grpc_channel_credentials_release(cached_creds);
grpc_channel_credentials_release(&creds->base);
grpc_httpcli_set_override(NULL, NULL);
grpc_override_well_known_credentials_path_getter(NULL);