|
|
|
@ -590,7 +590,7 @@ grpc_sync_images() { |
|
|
|
|
done |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_launch_server_args() { |
|
|
|
|
_grpc_show_servers_args() { |
|
|
|
|
[[ -n $1 ]] && { # host |
|
|
|
|
host=$1 |
|
|
|
|
shift |
|
|
|
@ -598,43 +598,89 @@ grpc_launch_server_args() { |
|
|
|
|
echo "$FUNCNAME: missing arg: host" 1>&2 |
|
|
|
|
return 1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[[ -n $1 ]] && { # server_type |
|
|
|
|
case $1 in |
|
|
|
|
cxx) grpc_port=8010 ;; |
|
|
|
|
go) grpc_port=8020 ;; |
|
|
|
|
java) grpc_port=8030 ;; |
|
|
|
|
node) grpc_port=8040 ;; |
|
|
|
|
python) grpc_port=8050 ;; |
|
|
|
|
ruby) grpc_port=8060 ;; |
|
|
|
|
*) echo "bad server_type: $1" 1>&2; return 1 ;; |
|
|
|
|
esac |
|
|
|
|
docker_label="grpc/$1" |
|
|
|
|
docker_name="grpc_interop_$1" |
|
|
|
|
|
|
|
|
|
# Shows servers on a docker instance. |
|
|
|
|
# |
|
|
|
|
# call-seq; |
|
|
|
|
# grpc_show_servers <server_name> |
|
|
|
|
# E.g |
|
|
|
|
# grpc_show_server grpc-docker-server |
|
|
|
|
# |
|
|
|
|
# Shows the grpc servers on the GCE instance <server_name> |
|
|
|
|
grpc_show_servers() { |
|
|
|
|
# declare vars local so that they don't pollute the shell environment |
|
|
|
|
# where they this func is used. |
|
|
|
|
local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone |
|
|
|
|
# set by _grpc_show_servers |
|
|
|
|
local host |
|
|
|
|
|
|
|
|
|
# set the project zone and check that all necessary args are provided |
|
|
|
|
_grpc_set_project_and_zone -f _grpc_show_servers_args "$@" || return 1 |
|
|
|
|
gce_has_instance $grpc_project $host || return 1; |
|
|
|
|
|
|
|
|
|
local cmd="sudo docker ps | grep grpc_" |
|
|
|
|
local ssh_cmd="bash -l -c \"$cmd\"" |
|
|
|
|
echo "will run:" |
|
|
|
|
echo " $ssh_cmd" |
|
|
|
|
echo "on $host" |
|
|
|
|
[[ $dry_run == 1 ]] && continue # don't run the command on a dry run |
|
|
|
|
gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_grpc_launch_servers_args() { |
|
|
|
|
[[ -n $1 ]] && { # host |
|
|
|
|
host=$1 |
|
|
|
|
shift |
|
|
|
|
} || { |
|
|
|
|
echo "$FUNCNAME: missing arg: server_type" 1>&2 |
|
|
|
|
echo "$FUNCNAME: missing arg: host" 1>&2 |
|
|
|
|
return 1 |
|
|
|
|
} |
|
|
|
|
[[ -n $1 ]] && { |
|
|
|
|
servers="$@" |
|
|
|
|
} || { |
|
|
|
|
servers="cxx java go node ruby" |
|
|
|
|
echo "$FUNCNAME: no servers specified, will launch defaults '$servers'" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Launches a server on a docker instance. |
|
|
|
|
# Launches servers on a docker instance. |
|
|
|
|
# |
|
|
|
|
# call-seq; |
|
|
|
|
# grpc_launch_server <server_name> <server_type> |
|
|
|
|
# grpc_launch_servers <server_name> [server1 server2 ...] |
|
|
|
|
# E.g |
|
|
|
|
# grpc_launch_server grpc-docker-server ruby node |
|
|
|
|
# |
|
|
|
|
# Runs the server_type on a GCE instance running docker with server_name |
|
|
|
|
grpc_launch_server() { |
|
|
|
|
# Restarts all the specified servers on the GCE instance <server_name> |
|
|
|
|
# If no servers are specified, it launches all known servers |
|
|
|
|
grpc_launch_servers() { |
|
|
|
|
# declare vars local so that they don't pollute the shell environment |
|
|
|
|
# where they this func is used. |
|
|
|
|
local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone |
|
|
|
|
# set by grpc_launch_server_args |
|
|
|
|
local docker_label docker_name host grpc_port |
|
|
|
|
# set by _grpc_launch_servers_args |
|
|
|
|
local host servers |
|
|
|
|
|
|
|
|
|
# set the project zone and check that all necessary args are provided |
|
|
|
|
_grpc_set_project_and_zone -f grpc_launch_server_args "$@" || return 1 |
|
|
|
|
_grpc_set_project_and_zone -f _grpc_launch_servers_args "$@" || return 1 |
|
|
|
|
gce_has_instance $grpc_project $host || return 1; |
|
|
|
|
|
|
|
|
|
# launch each of the servers in turn |
|
|
|
|
for server in $servers |
|
|
|
|
do |
|
|
|
|
local grpc_port |
|
|
|
|
case $server in |
|
|
|
|
cxx) grpc_port=8010 ;; |
|
|
|
|
go) grpc_port=8020 ;; |
|
|
|
|
java) grpc_port=8030 ;; |
|
|
|
|
node) grpc_port=8040 ;; |
|
|
|
|
python) grpc_port=8050 ;; |
|
|
|
|
ruby) grpc_port=8060 ;; |
|
|
|
|
*) echo "bad server_type: $1" 1>&2; return 1 ;; |
|
|
|
|
esac |
|
|
|
|
local docker_label="grpc/$server" |
|
|
|
|
local docker_name="grpc_interop_$server" |
|
|
|
|
|
|
|
|
|
cmd="sudo docker kill $docker_name > /dev/null 2>&1; " |
|
|
|
|
cmd+="sudo docker rm $docker_name > /dev/null 2>&1; " |
|
|
|
|
cmd+="sudo docker run -d --name $docker_name" |
|
|
|
@ -647,6 +693,7 @@ grpc_launch_server() { |
|
|
|
|
echo "on $host" |
|
|
|
|
[[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run |
|
|
|
|
gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" |
|
|
|
|
done |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Runs a test command on a docker instance. |
|
|
|
@ -822,7 +869,6 @@ grpc_interop_gen_ruby_cmd() { |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# constructs the full dockerized java interop test cmd. |
|
|
|
|
# |
|
|
|
|
# call-seq: |
|
|
|
@ -832,12 +878,43 @@ grpc_cloud_prod_gen_ruby_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c" |
|
|
|
|
local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" |
|
|
|
|
local test_script+=" --use_tls" |
|
|
|
|
local gfe_flags=" --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" |
|
|
|
|
local gfe_flags=$(_grpc_prod_gfe_flags) |
|
|
|
|
local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" |
|
|
|
|
local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $@'" |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# constructs the full dockerized ruby service_account auth interop test cmd. |
|
|
|
|
# |
|
|
|
|
# call-seq: |
|
|
|
|
# flags= .... # generic flags to include the command |
|
|
|
|
# cmd=$($grpc_gen_test_cmd $flags) |
|
|
|
|
grpc_cloud_prod_auth_service_account_creds_gen_ruby_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; |
|
|
|
|
local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" |
|
|
|
|
local test_script+=" --use_tls" |
|
|
|
|
local gfe_flags=$(_grpc_prod_gfe_flags) |
|
|
|
|
local added_gfe_flags=$(_grpc_svc_acc_test_flags) |
|
|
|
|
local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" |
|
|
|
|
local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $added_gfe_flag $@'" |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# constructs the full dockerized ruby gce auth interop test cmd. |
|
|
|
|
# |
|
|
|
|
# call-seq: |
|
|
|
|
# flags= .... # generic flags to include the command |
|
|
|
|
# cmd=$($grpc_gen_test_cmd $flags) |
|
|
|
|
grpc_cloud_prod_auth_compute_engine_creds_gen_ruby_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; |
|
|
|
|
local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" |
|
|
|
|
local test_script+=" --use_tls" |
|
|
|
|
local gfe_flags=$(_grpc_prod_gfe_flags) |
|
|
|
|
local added_gfe_flags=$(_grpc_gce_test_flags) |
|
|
|
|
local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" |
|
|
|
|
local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $added_gfe_flag $@'" |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# constructs the full dockerized Go interop test cmd. |
|
|
|
|
# |
|
|
|
@ -888,7 +965,7 @@ grpc_cloud_prod_gen_java_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/java"; |
|
|
|
|
local test_script="/var/local/git/grpc-java/run-test-client.sh"; |
|
|
|
|
local test_script+=" --use_tls=true" |
|
|
|
|
local gfe_flags=" --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" |
|
|
|
|
local gfe_flags=$(_grpc_prod_gfe_flags) |
|
|
|
|
local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
@ -909,19 +986,11 @@ grpc_interop_gen_php_cmd() { |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# constructs the full dockerized cpp interop test cmd. |
|
|
|
|
# |
|
|
|
|
# constructs the full dockerized node interop test cmd. |
|
|
|
|
# |
|
|
|
|
# call-seq: |
|
|
|
|
# flags= .... # generic flags to include the command |
|
|
|
|
# cmd=$($grpc_gen_test_cmd $flags) |
|
|
|
|
grpc_interop_gen_cxx_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/cxx"; |
|
|
|
|
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; |
|
|
|
|
local the_cmd="$cmd_prefix $test_script $@"; |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_interop_gen_node_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/node"; |
|
|
|
|
local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; |
|
|
|
@ -931,46 +1000,70 @@ grpc_interop_gen_node_cmd() { |
|
|
|
|
|
|
|
|
|
# constructs the full dockerized cpp interop test cmd. |
|
|
|
|
# |
|
|
|
|
# call-seq: |
|
|
|
|
# flags= .... # generic flags to include the command |
|
|
|
|
# cmd=$($grpc_gen_test_cmd $flags) |
|
|
|
|
grpc_interop_gen_cxx_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/cxx"; |
|
|
|
|
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; |
|
|
|
|
local the_cmd="$cmd_prefix $test_script $@"; |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# constructs the full dockerized cpp gce=>prod interop test cmd. |
|
|
|
|
# |
|
|
|
|
# call-seq: |
|
|
|
|
# flags= .... # generic flags to include the command |
|
|
|
|
# cmd=$($grpc_gen_test_cmd $flags) |
|
|
|
|
grpc_cloud_prod_gen_cxx_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/cxx"; |
|
|
|
|
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; |
|
|
|
|
local gfe_flags=" --use_prod_roots --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" |
|
|
|
|
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; |
|
|
|
|
local gfe_flags=$(_grpc_prod_gfe_flags) |
|
|
|
|
local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# constructs the full dockerized cpp interop test cmd. |
|
|
|
|
# |
|
|
|
|
# constructs the full dockerized cpp service_account auth interop test cmd. |
|
|
|
|
# |
|
|
|
|
# call-seq: |
|
|
|
|
# flags= .... # generic flags to include the command |
|
|
|
|
# cmd=$($grpc_gen_test_cmd $flags) |
|
|
|
|
grpc_cloud_prod_auth_service_account_creds_gen_cxx_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/cxx"; |
|
|
|
|
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; |
|
|
|
|
local gfe_flags=" --use_prod_roots --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" |
|
|
|
|
local added_gfe_flags=" --service_account_key_file=/service_account/stubbyCloudTestingTest-7dd63462c60c.json --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" |
|
|
|
|
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; |
|
|
|
|
local gfe_flags=$(_grpc_prod_gfe_flags) |
|
|
|
|
local added_gfe_flags=$(_grpc_svc_acc_test_flags) |
|
|
|
|
local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# constructs the full dockerized cpp interop test cmd. |
|
|
|
|
# |
|
|
|
|
# constructs the full dockerized cpp gce auth interop test cmd. |
|
|
|
|
# |
|
|
|
|
# call-seq: |
|
|
|
|
# flags= .... # generic flags to include the command |
|
|
|
|
# cmd=$($grpc_gen_test_cmd $flags) |
|
|
|
|
grpc_cloud_prod_auth_compute_engine_creds_gen_cxx_cmd() { |
|
|
|
|
local cmd_prefix="sudo docker run grpc/cxx"; |
|
|
|
|
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; |
|
|
|
|
local gfe_flags=" --use_prod_roots --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" |
|
|
|
|
local added_gfe_flags=" --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" |
|
|
|
|
local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; |
|
|
|
|
local gfe_flags=$(_grpc_prod_gfe_flags) |
|
|
|
|
local added_gfe_flags=$(_grpc_gce_test_flags) |
|
|
|
|
local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; |
|
|
|
|
echo $the_cmd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python|nodejs |
|
|
|
|
# outputs the flags passed to gfe tests |
|
|
|
|
_grpc_prod_gfe_flags() { |
|
|
|
|
echo " --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# outputs the flags passed to the service account auth tests |
|
|
|
|
_grpc_svc_acc_test_flags() { |
|
|
|
|
echo " --service_account_key_file=/service_account/stubbyCloudTestingTest-7dd63462c60c.json --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# outputs the flags passed to the gcloud auth tests |
|
|
|
|
_grpc_gce_test_flags() { |
|
|
|
|
echo " --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python |
|
|
|
|