add php compute_engine_creds auth interop test

pull/1476/head
Stanley Cheung 10 years ago
parent a0e1454021
commit e19497a9d5
  1. 24
      src/php/tests/interop/interop_client.php
  2. 31
      tools/gce_setup/grpc_docker.sh

@ -125,6 +125,24 @@ function serviceAccountCreds($stub, $args) {
'invalid oauth scope returned');
}
/**
* Run the compute engine credentials auth test.
* Has not been run from gcloud as of 2015-05-05
* @param $stub Stub object that has service methods
* @param $args array command line args
*/
function computeEngineCreds($stub, $args) {
if (!array_key_exists('oauth_scope', $args)) {
throw new Exception('Missing oauth scope');
}
if (!array_key_exists('default_service_account', $args)) {
throw new Exception('Missing default_service_account');
}
$result = performLargeUnary($stub, $fillUsername=true, $fillOauthScope=true);
hardAssert($args['default_service_account'] == $result->getUsername(),
'invalid email returned');
}
/**
* Run the client_streaming test.
* Passes when run against the Node server as of 2015-04-30
@ -240,7 +258,8 @@ function cancelAfterFirstResponse($stub) {
}
$args = getopt('', array('server_host:', 'server_port:', 'test_case:',
'server_host_override:', 'oauth_scope:'));
'server_host_override:', 'oauth_scope:',
'default_service_account:'));
if (!array_key_exists('server_host', $args) ||
!array_key_exists('server_port', $args) ||
!array_key_exists('test_case', $args)) {
@ -301,6 +320,9 @@ switch ($args['test_case']) {
case 'service_account_creds':
serviceAccountCreds($stub, $args);
break;
case 'compute_engine_creds':
computeEngineCreds($stub, $args);
break;
default:
exit(1);
}

@ -1250,6 +1250,37 @@ grpc_interop_gen_php_cmd() {
echo $the_cmd
}
# constructs the full dockerized php 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_php_cmd() {
local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem "
env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-7dd63462c60c.json "
local cmd_prefix="sudo docker run $env_flag grpc/php";
local test_script="/var/local/git/grpc/src/php/bin/interop_client.sh";
local gfe_flags=$(_grpc_prod_gfe_flags);
local added_gfe_flags=$(_grpc_default_creds_test_flags)
local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@";
echo $the_cmd
}
# constructs the full dockerized php compute_engine 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_php_cmd() {
local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem "
local cmd_prefix="sudo docker run $env_flag grpc/php";
local test_script="/var/local/git/grpc/src/php/bin/interop_client.sh";
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
}
# constructs the full dockerized node interop test cmd.
#
# call-seq:

Loading…
Cancel
Save