diff options
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/client/credentials_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 8 | ||||
-rw-r--r-- | test/cpp/interop/client.cc | 8 | ||||
-rw-r--r-- | test/cpp/interop/client_helper.cc | 20 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.cc | 18 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.h | 3 |
6 files changed, 10 insertions, 51 deletions
diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index 6fb24d71e5..18fcffe7cd 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -45,8 +45,8 @@ class CredentialsTest : public ::testing::Test { protected: }; -TEST_F(CredentialsTest, InvalidServiceAccountCreds) { - std::shared_ptr<Credentials> bad1 = ServiceAccountCredentials("", "", 1); +TEST_F(CredentialsTest, InvalidGoogleRefreshToken) { + std::shared_ptr<Credentials> bad1 = GoogleRefreshTokenCredentials(""); EXPECT_EQ(static_cast<Credentials*>(nullptr), bad1.get()); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 93486a7c67..3fc73ab9e5 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -633,7 +633,7 @@ TEST_F(End2endTest, DiffPackageServices) { // rpc and stream should fail on bad credentials. TEST_F(End2endTest, BadCredentials) { - std::shared_ptr<Credentials> bad_creds = ServiceAccountCredentials("", "", 1); + std::shared_ptr<Credentials> bad_creds = GoogleRefreshTokenCredentials(""); EXPECT_EQ(static_cast<Credentials*>(nullptr), bad_creds.get()); std::shared_ptr<Channel> channel = CreateChannel(server_address_.str(), bad_creds); @@ -814,7 +814,7 @@ TEST_F(End2endTest, SetPerCallCredentials) { EchoResponse response; ClientContext context; std::shared_ptr<Credentials> creds = - IAMCredentials("fake_token", "fake_selector"); + GoogleIAMCredentials("fake_token", "fake_selector"); context.set_credentials(creds); request.set_message("Hello"); request.mutable_param()->set_echo_metadata(true); @@ -851,10 +851,10 @@ TEST_F(End2endTest, OverridePerCallCredentials) { EchoResponse response; ClientContext context; std::shared_ptr<Credentials> creds1 = - IAMCredentials("fake_token1", "fake_selector1"); + GoogleIAMCredentials("fake_token1", "fake_selector1"); context.set_credentials(creds1); std::shared_ptr<Credentials> creds2 = - IAMCredentials("fake_token2", "fake_selector2"); + GoogleIAMCredentials("fake_token2", "fake_selector2"); context.set_credentials(creds2); request.set_message("Hello"); request.mutable_param()->set_echo_metadata(true); diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index cb5232153b..20fe1c515f 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -68,7 +68,6 @@ DEFINE_string(test_case, "large_unary", "cancel_after_begin : cancel stream after starting it; " "cancel_after_first_response: cancel on first response; " "timeout_on_sleeping_server: deadline exceeds on stream; " - "service_account_creds : large_unary with service_account auth; " "compute_engine_creds: large_unary with compute engine auth; " "jwt_token_creds: large_unary with JWT token auth; " "oauth2_auth_token: raw oauth2 access token auth; " @@ -114,9 +113,6 @@ int main(int argc, char** argv) { client.DoCancelAfterFirstResponse(); } else if (FLAGS_test_case == "timeout_on_sleeping_server") { client.DoTimeoutOnSleepingServer(); - } else if (FLAGS_test_case == "service_account_creds") { - grpc::string json_key = GetServiceAccountJsonKey(); - client.DoServiceAccountCreds(json_key, FLAGS_oauth_scope); } else if (FLAGS_test_case == "compute_engine_creds") { client.DoComputeEngineCreds(FLAGS_default_service_account, FLAGS_oauth_scope); @@ -146,7 +142,6 @@ int main(int argc, char** argv) { // service_account_creds and jwt_token_creds can only run with ssl. if (FLAGS_enable_ssl) { grpc::string json_key = GetServiceAccountJsonKey(); - client.DoServiceAccountCreds(json_key, FLAGS_oauth_scope); client.DoJwtTokenCreds(json_key); client.DoOauth2AuthToken(json_key, FLAGS_oauth_scope); client.DoPerRpcCreds(json_key, FLAGS_oauth_scope); @@ -159,8 +154,7 @@ int main(int argc, char** argv) { "large_unary|large_compressed_unary|client_streaming|server_streaming|" "server_compressed_streaming|half_duplex|ping_pong|cancel_after_begin|" "cancel_after_first_response|timeout_on_sleeping_server|" - "service_account_creds|compute_engine_creds|jwt_token_creds|" - "oauth2_auth_token|per_rpc_creds", + "compute_engine_creds|jwt_token_creds|oauth2_auth_token|per_rpc_creds", FLAGS_test_case.c_str()); ret = 1; } diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index abc14aeb98..7093463fa8 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -64,16 +64,6 @@ DECLARE_string(oauth_scope); namespace grpc { namespace testing { -namespace { -std::shared_ptr<Credentials> CreateServiceAccountCredentials() { - GPR_ASSERT(FLAGS_enable_ssl); - grpc::string json_key = GetServiceAccountJsonKey(); - std::chrono::seconds token_lifetime = std::chrono::hours(1); - return ServiceAccountCredentials(json_key, FLAGS_oauth_scope, - token_lifetime.count()); -} -} // namespace - grpc::string GetServiceAccountJsonKey() { static grpc::string json_key; if (json_key.empty()) { @@ -86,7 +76,7 @@ grpc::string GetServiceAccountJsonKey() { } grpc::string GetOauth2AccessToken() { - std::shared_ptr<Credentials> creds = CreateServiceAccountCredentials(); + std::shared_ptr<Credentials> creds = GoogleComputeEngineCredentials(); SecureCredentials* secure_creds = dynamic_cast<SecureCredentials*>(creds.get()); GPR_ASSERT(secure_creds != nullptr); @@ -107,14 +97,10 @@ std::shared_ptr<Channel> CreateChannelForTestCase( snprintf(host_port, host_port_buf_size, "%s:%d", FLAGS_server_host.c_str(), FLAGS_server_port); - if (test_case == "service_account_creds") { - std::shared_ptr<Credentials> creds = CreateServiceAccountCredentials(); - return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); - } else if (test_case == "compute_engine_creds") { + if (test_case == "compute_engine_creds") { std::shared_ptr<Credentials> creds; GPR_ASSERT(FLAGS_enable_ssl); - creds = ComputeEngineCredentials(); + creds = GoogleComputeEngineCredentials(); return CreateTestChannel(host_port, FLAGS_server_host_override, FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); } else if (test_case == "jwt_token_creds") { diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index ca13cdc53d..73d1a143c4 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -179,24 +179,6 @@ void InteropClient::DoComputeEngineCreds( gpr_log(GPR_INFO, "Large unary with compute engine creds done."); } -void InteropClient::DoServiceAccountCreds(const grpc::string& username, - const grpc::string& oauth_scope) { - gpr_log(GPR_INFO, - "Sending a large unary rpc with service account credentials ..."); - SimpleRequest request; - SimpleResponse response; - request.set_fill_username(true); - request.set_fill_oauth_scope(true); - request.set_response_type(PayloadType::COMPRESSABLE); - PerformLargeUnary(&request, &response); - GPR_ASSERT(!response.username().empty()); - GPR_ASSERT(!response.oauth_scope().empty()); - GPR_ASSERT(username.find(response.username()) != grpc::string::npos); - const char* oauth_scope_str = response.oauth_scope().c_str(); - GPR_ASSERT(oauth_scope.find(oauth_scope_str) != grpc::string::npos); - gpr_log(GPR_INFO, "Large unary with service account creds done."); -} - void InteropClient::DoOauth2AuthToken(const grpc::string& username, const grpc::string& oauth_scope) { gpr_log(GPR_INFO, diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index 5e26cc82e6..5a085c4c02 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -69,9 +69,6 @@ class InteropClient { void DoComputeEngineCreds(const grpc::string& default_service_account, const grpc::string& oauth_scope); // username is a string containing the user email - void DoServiceAccountCreds(const grpc::string& username, - const grpc::string& oauth_scope); - // username is a string containing the user email void DoOauth2AuthToken(const grpc::string& username, const grpc::string& oauth_scope); // username is a string containing the user email |