enable_ssl to use_tls

pull/3386/head
yang-g 9 years ago
parent 2b2a1ad6ca
commit 035cf093de
  1. 4
      test/cpp/interop/client.cc
  2. 14
      test/cpp/interop/client_helper.cc
  3. 2
      test/cpp/interop/server.cc
  4. 4
      test/cpp/interop/server_helper.cc
  5. 2
      tools/dockerfile/grpc_cxx/Dockerfile
  6. 10
      tools/gce_setup/grpc_docker.sh

@ -45,7 +45,7 @@
#include "test/cpp/interop/interop_client.h" #include "test/cpp/interop/interop_client.h"
#include "test/cpp/util/test_config.h" #include "test/cpp/util/test_config.h"
DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); DEFINE_bool(use_tls, false, "Whether to use tls.");
DEFINE_bool(use_prod_roots, false, "True to use SSL roots for google"); DEFINE_bool(use_prod_roots, false, "True to use SSL roots for google");
DEFINE_int32(server_port, 0, "Server port."); DEFINE_int32(server_port, 0, "Server port.");
DEFINE_string(server_host, "127.0.0.1", "Server host to connect to"); DEFINE_string(server_host, "127.0.0.1", "Server host to connect to");
@ -143,7 +143,7 @@ int main(int argc, char** argv) {
client.DoEmptyStream(); client.DoEmptyStream();
client.DoStatusWithMessage(); client.DoStatusWithMessage();
// service_account_creds and jwt_token_creds can only run with ssl. // service_account_creds and jwt_token_creds can only run with ssl.
if (FLAGS_enable_ssl) { if (FLAGS_use_tls) {
grpc::string json_key = GetServiceAccountJsonKey(); grpc::string json_key = GetServiceAccountJsonKey();
client.DoJwtTokenCreds(json_key); client.DoJwtTokenCreds(json_key);
client.DoOauth2AuthToken( client.DoOauth2AuthToken(

@ -51,7 +51,7 @@
#include "test/core/security/oauth2_utils.h" #include "test/core/security/oauth2_utils.h"
#include "test/cpp/util/create_test_channel.h" #include "test/cpp/util/create_test_channel.h"
DECLARE_bool(enable_ssl); DECLARE_bool(use_tls);
DECLARE_bool(use_prod_roots); DECLARE_bool(use_prod_roots);
DECLARE_int32(server_port); DECLARE_int32(server_port);
DECLARE_string(server_host); DECLARE_string(server_host);
@ -99,27 +99,27 @@ std::shared_ptr<Channel> CreateChannelForTestCase(
if (test_case == "compute_engine_creds") { if (test_case == "compute_engine_creds") {
std::shared_ptr<Credentials> creds; std::shared_ptr<Credentials> creds;
GPR_ASSERT(FLAGS_enable_ssl); GPR_ASSERT(FLAGS_use_tls);
creds = GoogleComputeEngineCredentials(); creds = GoogleComputeEngineCredentials();
return CreateTestChannel(host_port, FLAGS_server_host_override, return CreateTestChannel(host_port, FLAGS_server_host_override,
FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); FLAGS_use_tls, FLAGS_use_prod_roots, creds);
} else if (test_case == "jwt_token_creds") { } else if (test_case == "jwt_token_creds") {
std::shared_ptr<Credentials> creds; std::shared_ptr<Credentials> creds;
GPR_ASSERT(FLAGS_enable_ssl); GPR_ASSERT(FLAGS_use_tls);
grpc::string json_key = GetServiceAccountJsonKey(); grpc::string json_key = GetServiceAccountJsonKey();
std::chrono::seconds token_lifetime = std::chrono::hours(1); std::chrono::seconds token_lifetime = std::chrono::hours(1);
creds = creds =
ServiceAccountJWTAccessCredentials(json_key, token_lifetime.count()); ServiceAccountJWTAccessCredentials(json_key, token_lifetime.count());
return CreateTestChannel(host_port, FLAGS_server_host_override, return CreateTestChannel(host_port, FLAGS_server_host_override,
FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); FLAGS_use_tls, FLAGS_use_prod_roots, creds);
} else if (test_case == "oauth2_auth_token") { } else if (test_case == "oauth2_auth_token") {
grpc::string raw_token = GetOauth2AccessToken(); grpc::string raw_token = GetOauth2AccessToken();
std::shared_ptr<Credentials> creds = AccessTokenCredentials(raw_token); std::shared_ptr<Credentials> creds = AccessTokenCredentials(raw_token);
return CreateTestChannel(host_port, FLAGS_server_host_override, return CreateTestChannel(host_port, FLAGS_server_host_override,
FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); FLAGS_use_tls, FLAGS_use_prod_roots, creds);
} else { } else {
return CreateTestChannel(host_port, FLAGS_server_host_override, return CreateTestChannel(host_port, FLAGS_server_host_override,
FLAGS_enable_ssl, FLAGS_use_prod_roots); FLAGS_use_tls, FLAGS_use_prod_roots);
} }
} }

@ -54,7 +54,7 @@
#include "test/proto/empty.grpc.pb.h" #include "test/proto/empty.grpc.pb.h"
#include "test/proto/messages.grpc.pb.h" #include "test/proto/messages.grpc.pb.h"
DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); DEFINE_bool(use_tls, false, "Whether to use tls.");
DEFINE_int32(port, 0, "Server port."); DEFINE_int32(port, 0, "Server port.");
using grpc::Server; using grpc::Server;

@ -41,13 +41,13 @@
#include "src/core/surface/call.h" #include "src/core/surface/call.h"
#include "test/core/end2end/data/ssl_test_data.h" #include "test/core/end2end/data/ssl_test_data.h"
DECLARE_bool(enable_ssl); DECLARE_bool(use_tls);
namespace grpc { namespace grpc {
namespace testing { namespace testing {
std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() { std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() {
if (FLAGS_enable_ssl) { if (FLAGS_use_tls) {
SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key,
test_server1_cert}; test_server1_cert};
SslServerCredentialsOptions ssl_opts; SslServerCredentialsOptions ssl_opts;

@ -54,4 +54,4 @@ ADD service_account service_account
ADD cacerts cacerts ADD cacerts cacerts
ENV GRPC_DEFAULT_SSL_ROOTS_FILE_PATH /cacerts/roots.pem ENV GRPC_DEFAULT_SSL_ROOTS_FILE_PATH /cacerts/roots.pem
CMD ["/var/local/git/grpc/bins/opt/interop_server", "--enable_ssl", "--port=8010"] CMD ["/var/local/git/grpc/bins/opt/interop_server", "--use_tls", "--port=8010"]

@ -1477,7 +1477,7 @@ grpc_cloud_prod_auth_compute_engine_creds_gen_node_cmd() {
# cmd=$($grpc_gen_test_cmd $flags) # cmd=$($grpc_gen_test_cmd $flags)
grpc_interop_gen_cxx_cmd() { grpc_interop_gen_cxx_cmd() {
local cmd_prefix="sudo docker run grpc/cxx"; local cmd_prefix="sudo docker run grpc/cxx";
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls";
local the_cmd="$cmd_prefix $test_script $@"; local the_cmd="$cmd_prefix $test_script $@";
echo $the_cmd echo $the_cmd
} }
@ -1489,7 +1489,7 @@ grpc_interop_gen_cxx_cmd() {
# cmd=$($grpc_gen_test_cmd $flags) # cmd=$($grpc_gen_test_cmd $flags)
grpc_cloud_prod_gen_cxx_cmd() { grpc_cloud_prod_gen_cxx_cmd() {
local cmd_prefix="sudo docker run grpc/cxx"; local cmd_prefix="sudo docker run grpc/cxx";
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_prod_roots";
local gfe_flags=$(_grpc_prod_gfe_flags) local gfe_flags=$(_grpc_prod_gfe_flags)
local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; local the_cmd="$cmd_prefix $test_script $gfe_flags $@";
echo $the_cmd echo $the_cmd
@ -1502,7 +1502,7 @@ grpc_cloud_prod_gen_cxx_cmd() {
# cmd=$($grpc_gen_test_cmd $flags) # cmd=$($grpc_gen_test_cmd $flags)
grpc_cloud_prod_auth_service_account_creds_gen_cxx_cmd() { grpc_cloud_prod_auth_service_account_creds_gen_cxx_cmd() {
local cmd_prefix="sudo docker run grpc/cxx"; local cmd_prefix="sudo docker run grpc/cxx";
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_prod_roots";
local gfe_flags=$(_grpc_prod_gfe_flags) local gfe_flags=$(_grpc_prod_gfe_flags)
local added_gfe_flags=$(_grpc_svc_acc_test_flags) local added_gfe_flags=$(_grpc_svc_acc_test_flags)
local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@";
@ -1516,7 +1516,7 @@ grpc_cloud_prod_auth_service_account_creds_gen_cxx_cmd() {
# cmd=$($grpc_gen_test_cmd $flags) # cmd=$($grpc_gen_test_cmd $flags)
grpc_cloud_prod_auth_compute_engine_creds_gen_cxx_cmd() { grpc_cloud_prod_auth_compute_engine_creds_gen_cxx_cmd() {
local cmd_prefix="sudo docker run grpc/cxx"; local cmd_prefix="sudo docker run grpc/cxx";
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_prod_roots";
local gfe_flags=$(_grpc_prod_gfe_flags) local gfe_flags=$(_grpc_prod_gfe_flags)
local added_gfe_flags=$(_grpc_gce_test_flags) local added_gfe_flags=$(_grpc_gce_test_flags)
local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@";
@ -1530,7 +1530,7 @@ grpc_cloud_prod_auth_compute_engine_creds_gen_cxx_cmd() {
# cmd=$($grpc_gen_test_cmd $flags) # cmd=$($grpc_gen_test_cmd $flags)
grpc_cloud_prod_auth_jwt_token_creds_gen_cxx_cmd() { grpc_cloud_prod_auth_jwt_token_creds_gen_cxx_cmd() {
local cmd_prefix="sudo docker run grpc/cxx"; local cmd_prefix="sudo docker run grpc/cxx";
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_prod_roots";
local gfe_flags=$(_grpc_prod_gfe_flags) local gfe_flags=$(_grpc_prod_gfe_flags)
local added_gfe_flags=$(_grpc_jwt_token_test_flags) local added_gfe_flags=$(_grpc_jwt_token_test_flags)
local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@";

Loading…
Cancel
Save