From f6bf2b59773fd7cb3d9c707f0d4a5789146353b0 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Mon, 30 May 2016 16:42:20 +0200 Subject: [PATCH] [tests] Troubles with HHVM <= 3.6.6 and float timeouts. HHVM is still being used by Travis CI but this bug makes the build to take 14 minutes to complete, which is unacceptable. --- tests/PHPUnit/PredisConnectionTestCase.php | 32 ++++++++++++---------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/PHPUnit/PredisConnectionTestCase.php b/tests/PHPUnit/PredisConnectionTestCase.php index 2b249383..ba149c70 100644 --- a/tests/PHPUnit/PredisConnectionTestCase.php +++ b/tests/PHPUnit/PredisConnectionTestCase.php @@ -116,18 +116,6 @@ abstract class PredisConnectionTestCase extends PredisTestCase $this->assertEquals($parameters, $unserialized->getParameters()); } - /** - * @group disconnected - * @group slow - * @expectedException \Predis\Connection\ConnectionException - */ - public function testThrowExceptionWhenUnableToConnect() - { - $parameters = array('host' => '169.254.10.10', 'timeout' => 0.5); - $connection = $this->createConnectionWithParams($parameters, false); - $connection->executeCommand($this->getCurrentProfile()->createCommand('ping')); - } - // ******************************************************************** // // ---- INTEGRATION TESTS --------------------------------------------- // // ******************************************************************** // @@ -448,9 +436,17 @@ abstract class PredisConnectionTestCase extends PredisTestCase */ public function testThrowsExceptionOnConnectionTimeout() { + // TODO: float timeouts for connect() under HHVM 3.6.6 are broken and, + // unfortunately, this is the version still being used by Travis CI. + if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.6.6', '<=')) { + $timeout = 1; + } else { + $timeout = 0.1; + } + $connection = $this->createConnectionWithParams(array( 'host' => '169.254.10.10', - 'timeout' => 0.1, + 'timeout' => $timeout, ), false); $connection->connect(); @@ -464,9 +460,17 @@ abstract class PredisConnectionTestCase extends PredisTestCase */ public function testThrowsExceptionOnConnectionTimeoutIPv6() { + // TODO: float timeouts for connect() under HHVM 3.6.6 are broken and, + // unfortunately, this is the version still being used by Travis CI. + if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.6.6', '<=')) { + $timeout = 1; + } else { + $timeout = 0.1; + } + $connection = $this->createConnectionWithParams(array( 'host' => '0:0:0:0:0:ffff:a9fe:a0a', - 'timeout' => 0.1, + 'timeout' => $timeout, ), false); $connection->connect();