mirror of
https://github.com/predis/predis.git
synced 2026-10-04 19:08:31 +00:00
Implement full support for IPv6.
Using IPv6 with Predis was basically impossible due to various inconsistencies and bugs through the library, now it is supported by all the connection classes. Following the standard for IPv6 literal addresses in URI strings, the IP literal must be enclosed within square brackets when passing the parameters as a string: $parameters = 'tcp://[2001:db8:0:f101::1]:6379'; See https://tools.ietf.org/html/rfc3986#section-3.2.2 for further details. This commit also fixes #239 making redis-cluster usable with nodes using IPv6.
This commit is contained in:
@@ -431,12 +431,45 @@ abstract class PredisConnectionTestCase extends PredisTestCase
|
||||
* @group connected
|
||||
* @group slow
|
||||
* @expectedException \Predis\Connection\ConnectionException
|
||||
* @expectedExceptionMessageRegExp /.* \[tcp:\/\/169.254.10.10:6379\]/
|
||||
*/
|
||||
public function testThrowsExceptionOnConnectionTimeout()
|
||||
{
|
||||
$connection = $this->createConnectionWithParams(array(
|
||||
'host' => '169.254.10.10',
|
||||
'timeout' => 0.5,
|
||||
'timeout' => 0.1,
|
||||
), false);
|
||||
|
||||
$connection->connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
* @group slow
|
||||
* @expectedException \Predis\Connection\ConnectionException
|
||||
* @expectedExceptionMessageRegExp /.* \[tcp:\/\/\[0:0:0:0:0:ffff:a9fe:a0a\]:6379\]/
|
||||
*/
|
||||
public function testThrowsExceptionOnConnectionTimeoutIPv6()
|
||||
{
|
||||
$connection = $this->createConnectionWithParams(array(
|
||||
'host' => '0:0:0:0:0:ffff:a9fe:a0a',
|
||||
'timeout' => 0.1,
|
||||
), false);
|
||||
|
||||
$connection->connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
* @group slow
|
||||
* @expectedException \Predis\Connection\ConnectionException
|
||||
* @expectedExceptionMessageRegExp /.* \[unix:\/tmp\/nonexistent\/redis\.sock]/
|
||||
*/
|
||||
public function testThrowsExceptionOnUnixDomainSocketNotFound()
|
||||
{
|
||||
$connection = $this->createConnectionWithParams(array(
|
||||
'scheme' => 'unix',
|
||||
'path' => '/tmp/nonexistent/redis.sock',
|
||||
), false);
|
||||
|
||||
$connection->connect();
|
||||
|
||||
Reference in New Issue
Block a user