Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Mar 28, 2024
1 parent 4e2f457 commit d76ce22
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
19 changes: 17 additions & 2 deletions tests/Predis/Cluster/PredisStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,21 @@ public function testKeysForEvalCommand(): void
}
}

/**
* @group disconnected
*/
public function testKeysForEvalReadOnlyCommand(): void
{
$strategy = $this->getClusterStrategy();
$commands = $this->getCommandFactory();
$arguments = ['%SCRIPT%', ['{key}:1', '{key}:2'], 'value1', 'value2'];

foreach ($this->getExpectedCommands('keys-script-ro') as $commandID) {
$command = $commands->create($commandID, $arguments);
$this->assertNotNull($strategy->getSlot($command), $commandID);
}
}

/**
* @group disconnected
*/
Expand Down Expand Up @@ -452,8 +467,8 @@ protected function getExpectedCommands(string $type = null): array
/* scripting */
'EVAL' => 'keys-script',
'EVALSHA' => 'keys-script',
'EVAL_RO' => 'keys-script',
'EVALSHA_RO' => 'keys-script',
'EVAL_RO' => 'keys-script-ro',
'EVALSHA_RO' => 'keys-script-ro',

/* server */
'INFO' => 'keys-fake',
Expand Down
19 changes: 17 additions & 2 deletions tests/Predis/Cluster/RedisStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,21 @@ public function testKeysForEvalCommand(): void
}
}

/**
* @group disconnected
*/
public function testKeysForEvalReadOnlyCommand(): void
{
$strategy = $this->getClusterStrategy();
$commands = $this->getCommandFactory();
$arguments = ['%SCRIPT%', ['key:1'], 'value1'];

foreach ($this->getExpectedCommands('keys-script-ro') as $commandID) {
$command = $commands->create($commandID, $arguments);
$this->assertNotNull($strategy->getSlot($command), $commandID);
}
}

/**
* @group disconnected
*/
Expand Down Expand Up @@ -475,8 +490,8 @@ protected function getExpectedCommands(string $type = null): array
/* scripting */
'EVAL' => 'keys-script',
'EVALSHA' => 'keys-script',
'EVAL_RO' => 'keys-script',
'EVALSHA_RO' => 'keys-script',
'EVAL_RO' => 'keys-script-ro',
'EVALSHA_RO' => 'keys-script-ro',

/* server */
'INFO' => 'keys-fake',
Expand Down

0 comments on commit d76ce22

Please sign in to comment.