diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index a6e4a89ac02..be801bf016b 100755 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -1,11 +1,13 @@ 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() { diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index d645c03e4c9..d14574b4f7d 100755 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -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 diff --git a/src/php/tests/util/port_picker.php b/src/php/tests/util/port_picker.php new file mode 100755 index 00000000000..d869d8b0a49 --- /dev/null +++ b/src/php/tests/util/port_picker.php @@ -0,0 +1,6 @@ +