|
@@ -264,8 +264,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
public function testGetIteratorReturnsConnectionsMappedInSlotsMapWhenUseClusterSlotsIsDisabled()
|
|
|
{
|
|
|
$connection1 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=0-5460');
|
|
|
- $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10921');
|
|
|
- $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10922-16383');
|
|
|
+ $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922');
|
|
|
+ $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10923-16383');
|
|
|
$connection4 = $this->getMockConnection('tcp://127.0.0.1:6384');
|
|
|
|
|
|
$cluster = new RedisCluster(new Connection\Factory());
|
|
@@ -292,8 +292,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
{
|
|
|
$slotsmap = array(
|
|
|
array(0, 5460, array('127.0.0.1', 6381), array()),
|
|
|
- array(5461, 10921, array('127.0.0.1', 6383), array()),
|
|
|
- array(10922, 16383, array('127.0.0.1', 6384), array()),
|
|
|
+ array(5461, 10922, array('127.0.0.1', 6383), array()),
|
|
|
+ array(10923, 16383, array('127.0.0.1', 6384), array()),
|
|
|
);
|
|
|
|
|
|
$connection1 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=0-5460');
|
|
@@ -305,7 +305,7 @@ class RedisClusterTest extends PredisTestCase
|
|
|
))
|
|
|
->will($this->returnValue($slotsmap));
|
|
|
|
|
|
- $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10921');
|
|
|
+ $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922');
|
|
|
$connection3 = $this->getMockConnection('tcp://127.0.0.1:6383');
|
|
|
$connection4 = $this->getMockConnection('tcp://127.0.0.1:6384');
|
|
|
|
|
@@ -385,11 +385,11 @@ class RedisClusterTest extends PredisTestCase
|
|
|
|
|
|
$slotmap = $cluster->getSlotMap();
|
|
|
$slotmap->setSlots(0, 5460, '127.0.0.1:6379');
|
|
|
- $slotmap->setSlots(5461, 10921, '127.0.0.1:6380');
|
|
|
+ $slotmap->setSlots(5461, 10922, '127.0.0.1:6380');
|
|
|
|
|
|
$expectedMap = array_merge(
|
|
|
array_fill(0, 5461, '127.0.0.1:6379'),
|
|
|
- array_fill(5460, 5461, '127.0.0.1:6380')
|
|
|
+ array_fill(5460, 5462, '127.0.0.1:6380')
|
|
|
);
|
|
|
|
|
|
$this->assertSame($expectedMap, $slotmap->toArray());
|
|
@@ -405,8 +405,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
public function testCanAssignConnectionsToRangeOfSlotsFromParameters()
|
|
|
{
|
|
|
$connection1 = $this->getMockConnection('tcp://127.0.0.1:6379?slots=0-5460');
|
|
|
- $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380?slots=5461-10921');
|
|
|
- $connection3 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=10922-16383');
|
|
|
+ $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380?slots=5461-10922');
|
|
|
+ $connection3 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=10923-16383');
|
|
|
|
|
|
$cluster = new RedisCluster(new Connection\Factory());
|
|
|
|
|
@@ -418,8 +418,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
|
|
|
$expectedMap = array_merge(
|
|
|
array_fill(0, 5461, '127.0.0.1:6379'),
|
|
|
- array_fill(5460, 5461, '127.0.0.1:6380'),
|
|
|
- array_fill(10921, 5462, '127.0.0.1:6381')
|
|
|
+ array_fill(5461, 5462, '127.0.0.1:6380'),
|
|
|
+ array_fill(10923, 5461, '127.0.0.1:6381')
|
|
|
);
|
|
|
|
|
|
$actualMap = $cluster->getSlotMap()->toArray();
|
|
@@ -435,8 +435,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
public function testCanAssignConnectionsToSingleSlotOrRangesOfSlotsFromParameters()
|
|
|
{
|
|
|
$connection1 = $this->getMockConnection('tcp://127.0.0.1:6379?slots=0-5460,5500-5600,11000');
|
|
|
- $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380?slots=5461-5499,5600-10921');
|
|
|
- $connection3 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=10922-10999,11001-16383');
|
|
|
+ $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380?slots=5461-5499,5600-10922');
|
|
|
+ $connection3 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=10923-10999,11001-16383');
|
|
|
|
|
|
$cluster = new RedisCluster(new Connection\Factory());
|
|
|
|
|
@@ -450,8 +450,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
array_fill(0, 5461, '127.0.0.1:6379'),
|
|
|
array_fill(5460, 39, '127.0.0.1:6380'),
|
|
|
array_fill(5499, 101, '127.0.0.1:6379'),
|
|
|
- array_fill(5599, 5321, '127.0.0.1:6380'),
|
|
|
- array_fill(10921, 78, '127.0.0.1:6381'),
|
|
|
+ array_fill(5599, 5322, '127.0.0.1:6380'),
|
|
|
+ array_fill(10923, 77, '127.0.0.1:6381'),
|
|
|
array_fill(11000, 1, '127.0.0.1:6379'),
|
|
|
array_fill(11000, 5383, '127.0.0.1:6381')
|
|
|
);
|
|
@@ -480,7 +480,7 @@ class RedisClusterTest extends PredisTestCase
|
|
|
|
|
|
$this->assertSame($connection1, $cluster->getConnectionBySlot(0));
|
|
|
$this->assertSame($connection2, $cluster->getConnectionBySlot(5461));
|
|
|
- $this->assertSame($connection3, $cluster->getConnectionBySlot(10922));
|
|
|
+ $this->assertSame($connection3, $cluster->getConnectionBySlot(10923));
|
|
|
|
|
|
$cluster->getSlotMap()->setSlots(5461, 7096, '127.0.0.1:6380');
|
|
|
$this->assertSame($connection2, $cluster->getConnectionBySlot(5461));
|
|
@@ -580,8 +580,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
{
|
|
|
$slotsmap = array(
|
|
|
array(0, 5460, array('127.0.0.1', 9381), array()),
|
|
|
- array(5461, 10921, array('127.0.0.1', 6382), array()),
|
|
|
- array(10922, 16383, array('127.0.0.1', 6383), array()),
|
|
|
+ array(5461, 10922, array('127.0.0.1', 6382), array()),
|
|
|
+ array(10923, 16383, array('127.0.0.1', 6383), array()),
|
|
|
);
|
|
|
|
|
|
$connection1 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=0-5460');
|
|
@@ -595,7 +595,7 @@ class RedisClusterTest extends PredisTestCase
|
|
|
new Connection\ConnectionException($connection1, 'Unknown connection error [127.0.0.1:6381]')
|
|
|
));
|
|
|
|
|
|
- $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10921');
|
|
|
+ $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922');
|
|
|
$connection2
|
|
|
->expects($this->any())
|
|
|
->method('executeCommand')
|
|
@@ -604,7 +604,7 @@ class RedisClusterTest extends PredisTestCase
|
|
|
))
|
|
|
->will($this->returnValue($slotsmap));
|
|
|
|
|
|
- $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10922-16383');
|
|
|
+ $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10923-16383');
|
|
|
$connection3
|
|
|
->expects($this->any())
|
|
|
->method('executeCommand')
|
|
@@ -764,8 +764,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
{
|
|
|
$slotsmap = array(
|
|
|
array(0, 5460, array('127.0.0.1', 9381), array()),
|
|
|
- array(5461, 10921, array('127.0.0.1', 6382), array()),
|
|
|
- array(10922, 16383, array('127.0.0.1', 6383), array()),
|
|
|
+ array(5461, 10922, array('127.0.0.1', 6382), array()),
|
|
|
+ array(10923, 16383, array('127.0.0.1', 6383), array()),
|
|
|
);
|
|
|
|
|
|
$connection1 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=0-5460');
|
|
@@ -779,7 +779,7 @@ class RedisClusterTest extends PredisTestCase
|
|
|
new Connection\ConnectionException($connection1, 'Unknown connection error [127.0.0.1:6381]')
|
|
|
));
|
|
|
|
|
|
- $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10921');
|
|
|
+ $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922');
|
|
|
$connection2
|
|
|
->expects($this->once())
|
|
|
->method('executeCommand')
|
|
@@ -790,7 +790,7 @@ class RedisClusterTest extends PredisTestCase
|
|
|
new Connection\ConnectionException($connection2, 'Unknown connection error [127.0.0.1:6383]')
|
|
|
));
|
|
|
|
|
|
- $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10922-16383');
|
|
|
+ $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10923-16383');
|
|
|
$connection3
|
|
|
->expects($this->once())
|
|
|
->method('executeCommand')
|
|
@@ -829,8 +829,8 @@ class RedisClusterTest extends PredisTestCase
|
|
|
{
|
|
|
$slotsmap = array(
|
|
|
array(0, 5460, array('127.0.0.1', 9381), array()),
|
|
|
- array(5461, 10921, array('127.0.0.1', 6382), array()),
|
|
|
- array(10922, 16383, array('127.0.0.1', 6383), array()),
|
|
|
+ array(5461, 10922, array('127.0.0.1', 6382), array()),
|
|
|
+ array(10923, 16383, array('127.0.0.1', 6383), array()),
|
|
|
);
|
|
|
|
|
|
$connection1 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=0-5460');
|
|
@@ -844,7 +844,7 @@ class RedisClusterTest extends PredisTestCase
|
|
|
new Connection\ConnectionException($connection1, 'Unknown connection error [127.0.0.1:6381]')
|
|
|
));
|
|
|
|
|
|
- $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10921');
|
|
|
+ $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922');
|
|
|
$connection2
|
|
|
->expects($this->any())
|
|
|
->method('executeCommand')
|
|
@@ -855,7 +855,7 @@ class RedisClusterTest extends PredisTestCase
|
|
|
new Connection\ConnectionException($connection2, 'Unknown connection error [127.0.0.1:6382]')
|
|
|
));
|
|
|
|
|
|
- $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10922-16383');
|
|
|
+ $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10923-16383');
|
|
|
$connection3
|
|
|
->expects($this->never())
|
|
|
->method('executeCommand');
|
|
@@ -1249,9 +1249,9 @@ class RedisClusterTest extends PredisTestCase
|
|
|
*/
|
|
|
public function testCanBeSerialized()
|
|
|
{
|
|
|
- $connection1 = $this->getMockConnection('tcp://127.0.0.1:6379?slots=0-1364');
|
|
|
- $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380?slots=1365-2729');
|
|
|
- $connection3 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=2730-4095');
|
|
|
+ $connection1 = $this->getMockConnection('tcp://127.0.0.1:6379?slots=0-5460');
|
|
|
+ $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380?slots=5461-10922');
|
|
|
+ $connection3 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=10923-16383');
|
|
|
|
|
|
$cluster = new RedisCluster(new Connection\Factory());
|
|
|
|