diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-05-19 13:20:43 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-05-19 13:20:43 -0700 |
commit | 54140f97602587766791250f63439a8981128249 (patch) | |
tree | 5fe3635647168018165e35e53754302f9e21c7ea /test/cpp/interop | |
parent | 1226387698e70ef3247fe35f1c5b964d6598ba97 (diff) | |
parent | ed9ae72e7b0f17507f5e876928f121722fcfe327 (diff) |
Merge pull request #6608 from yang-g/interop
Assert we get a valid creds.
Diffstat (limited to 'test/cpp/interop')
-rw-r--r-- | test/cpp/interop/client_helper.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index c8b1e505c1..c171969e14 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -97,30 +97,25 @@ std::shared_ptr<Channel> CreateChannelForTestCase( snprintf(host_port, host_port_buf_size, "%s:%d", FLAGS_server_host.c_str(), FLAGS_server_port); + std::shared_ptr<CallCredentials> creds; if (test_case == "compute_engine_creds") { - std::shared_ptr<CallCredentials> creds; GPR_ASSERT(FLAGS_use_tls); creds = GoogleComputeEngineCredentials(); - return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_use_tls, !FLAGS_use_test_ca, creds); + GPR_ASSERT(creds); } else if (test_case == "jwt_token_creds") { - std::shared_ptr<CallCredentials> creds; GPR_ASSERT(FLAGS_use_tls); grpc::string json_key = GetServiceAccountJsonKey(); std::chrono::seconds token_lifetime = std::chrono::hours(1); creds = ServiceAccountJWTAccessCredentials(json_key, token_lifetime.count()); - return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_use_tls, !FLAGS_use_test_ca, creds); + GPR_ASSERT(creds); } else if (test_case == "oauth2_auth_token") { grpc::string raw_token = GetOauth2AccessToken(); - std::shared_ptr<CallCredentials> creds = AccessTokenCredentials(raw_token); - return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_use_tls, !FLAGS_use_test_ca, creds); - } else { - return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_use_tls, !FLAGS_use_test_ca); + creds = AccessTokenCredentials(raw_token); + GPR_ASSERT(creds); } + return CreateTestChannel(host_port, FLAGS_server_host_override, FLAGS_use_tls, + !FLAGS_use_test_ca, creds); } } // namespace testing |