diff options
author | Yang Gao <yangg@google.com> | 2018-10-26 22:32:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-26 22:32:27 -0700 |
commit | 7b419202a78fdc54110e056ebafefd9cbd719ffe (patch) | |
tree | 6dcc2ca878a7d69b36118230000a067c1c626c6b /test | |
parent | e0160eb02b8e108f29dc3a6e46010a20017c0a88 (diff) | |
parent | a35f55fd703762042c6d47ec17da1ecdd4397fe2 (diff) |
Merge pull request #17019 from yang-g/default_creds
Remove the internal caching for google_default_credentials
Diffstat (limited to 'test')
-rw-r--r-- | test/core/security/credentials_test.cc | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index 97156761bd..56c4c9c0ae 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -43,6 +43,7 @@ #include "src/core/lib/security/transport/auth_filters.h" #include "test/core/util/test_config.h" +using grpc_core::internal::grpc_flush_cached_google_default_credentials; using grpc_core::internal::set_gce_tenancy_checker_for_testing; /* -- Mock channel credentials. -- */ @@ -954,17 +955,9 @@ static void test_google_default_creds_gce(void) { run_request_metadata_test(creds->call_creds, auth_md_ctx, state); grpc_core::ExecCtx::Get()->Flush(); - /* Check that we get a cached creds if we call - grpc_google_default_credentials_create again. - GCE detection should not occur anymore either. */ - g_test_gce_tenancy_checker_called = false; - grpc_channel_credentials* cached_creds = - grpc_google_default_credentials_create(); - GPR_ASSERT(cached_creds == &creds->base); - GPR_ASSERT(g_test_gce_tenancy_checker_called == false); + GPR_ASSERT(g_test_gce_tenancy_checker_called == true); /* Cleanup. */ - grpc_channel_credentials_unref(cached_creds); grpc_channel_credentials_unref(&creds->base); grpc_httpcli_set_override(nullptr, nullptr); grpc_override_well_known_credentials_path_getter(nullptr); @@ -983,7 +976,7 @@ static void test_no_google_default_creds(void) { /* Simulate a successful detection of GCE. */ GPR_ASSERT(grpc_google_default_credentials_create() == nullptr); - /* Try a cached one. GCE detection should not occur anymore. */ + /* Try a second one. GCE detection should not occur anymore. */ g_test_gce_tenancy_checker_called = false; GPR_ASSERT(grpc_google_default_credentials_create() == nullptr); GPR_ASSERT(g_test_gce_tenancy_checker_called == false); |