Merge pull request #23142 from stanley-cheung/add-xds-timeout

Set timeout to PHP/Ruby xDS test
pull/23151/head
Stanley Cheung 5 years ago committed by GitHub
commit 9e2b5ef857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/php/tests/interop/xds_client.php
  2. 3
      src/ruby/pb/test/xds_client.rb

@ -98,6 +98,7 @@ class ClientThread extends Thread {
// Autoloaded classes do not get inherited in threads.
// Hence we need to do this.
require_once($this->autoload_path_);
$TIMEOUT_US = 30 * 1e6; // 30 seconds
$stub = new Grpc\Testing\TestServiceClient($this->server_address_, [
'credentials' => Grpc\ChannelCredentials::createInsecure()
@ -121,7 +122,8 @@ class ClientThread extends Thread {
usleep($sleep_us);
}
list($response, $status)
= $stub->UnaryCall($request)->wait();
= $stub->UnaryCall($request, [],
['timeout' => $TIMEOUT_US])->wait();
if ($status->code == Grpc\STATUS_OK) {
$this->results[] = $response->getHostname();
} else {

@ -122,7 +122,8 @@ def run_test_loop(stub, target_seconds_between_rpcs, fail_on_failed_rpcs)
sleep(sleep_seconds)
end
begin
resp = stub.unary_call(req)
deadline = GRPC::Core::TimeConsts::from_relative_time(30) # 30 seconds
resp = stub.unary_call(req, deadline: deadline)
remote_peer = resp.hostname
rescue GRPC::BadStatus => e
remote_peer = ""

Loading…
Cancel
Save