4 * Copyright 2021 gRPC authors.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 $autoload_path = realpath(dirname(__FILE__).'/../../vendor/autoload.php');
21 require_once $autoload_path;
23 // This script is used to launch 1 single EmptyCall RPC, most likely
24 // for the purpose of starting such RPC asynchronously away from the
25 // main PHP xDS interop client src/php/tests/interop/xds_client.php.
27 // This script is launched from src/php/bin/xds_manager.py. The result
28 // of this RPC will be aggregated and reported back to the main runner
31 $args = getopt('', ['server:', 'num:',
32 'metadata:', 'timeout_sec:']);
33 $TIMEOUT_US = 30 * 1e6; // 30 seconds
35 $server_address = $args['server'];
38 $stub = new Grpc\Testing\TestServiceClient($server_address, [
39 'credentials' => Grpc\ChannelCredentials::createInsecure()
42 $empty_request = new Grpc\Testing\EmptyMessage();
44 $timeout = $args['timeout_sec'] ? $args['timeout_sec'] * 1e6 : $TIMEOUT_US;
46 if ($args['metadata']) {
47 $metadata = unserialize($args['metadata']);
50 $call = $stub->EmptyCall($empty_request,
52 ['timeout' => $timeout]);
53 list($response, $status) = $call->wait();