Added utility to make different tests bind to different ports

Change on 2014/12/10 by mlumish <mlumish@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81800876
pull/1/merge
mlumish 10 years ago committed by Michael Lumish
parent 8919f6087f
commit f5aa29b628
  1. 6
      src/php/tests/unit_tests/EndToEndTest.php
  2. 5
      src/php/tests/unit_tests/SecureEndToEndTest.php
  3. 6
      src/php/tests/util/port_picker.php

@ -1,11 +1,13 @@
<?php
require __DIR__ . '/../util/port_picker.php';
class EndToEndTest extends PHPUnit_Framework_TestCase{
public function setUp() {
$this->client_queue = new Grpc\CompletionQueue();
$this->server_queue = new Grpc\CompletionQueue();
$this->server = new Grpc\Server($this->server_queue, []);
$this->server->add_http2_port('localhost:9000');
$this->channel = new Grpc\Channel('localhost:9000', []);
$address = '127.0.0.1:' . getNewPort();
$this->server->add_http2_port($address);
$this->channel = new Grpc\Channel($address, []);
}
public function tearDown() {

@ -11,9 +11,10 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{
file_get_contents(dirname(__FILE__) . '/../data/server1.pem'));
$this->server = new Grpc\Server($this->server_queue,
['credentials' => $server_credentials]);
$this->server->add_secure_http2_port('localhost:9000');
$address = '127.0.0.1:' . getNewPort();
$this->server->add_secure_http2_port($address);
$this->channel = new Grpc\Channel(
'localhost:9000',
$address,
[
'grpc.ssl_target_name_override' => 'foo.test.google.com',
'credentials' => $credentials

@ -0,0 +1,6 @@
<?php
function getNewPort() {
static $port = 10000;
$port += 1;
return $port;
}
Loading…
Cancel
Save