Skip to content

Commit 2402088

Browse files
committed
Merge branch 'master' into 3.0-merge
# Conflicts: # .github/workflows/test.yml # phpstan.neon # src/kafka/src/Producer.php # src/load-balancer/src/Node.php # src/retry/tests/RetryAnnotationAspectTest.php # src/session/src/Handler/FileHandler.php
2 parents 7895941 + c983a64 commit 2402088

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

publish/redis.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
'nodes' => explode(';', env('REDIS_SENTINEL_NODE', '')),
3030
'persistent' => '',
3131
'read_timeout' => 0,
32+
'auth' => null,
3233
],
3334
'pool' => [
3435
'min_connections' => 1,

src/RedisConnection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ protected function createRedisSentinel(): \Redis
194194
$retryInterval = $this->config['retry_interval'] ?? 0;
195195
$readTimeout = $this->config['sentinel']['read_timeout'] ?? 0;
196196
$masterName = $this->config['sentinel']['master_name'] ?? '';
197+
$auth = $this->config['sentinel']['auth'] ?? null;
197198
shuffle($nodes);
198199

199200
$host = null;
@@ -207,7 +208,8 @@ protected function createRedisSentinel(): \Redis
207208
$timeout,
208209
$persistent,
209210
$retryInterval,
210-
$readTimeout
211+
$readTimeout,
212+
$auth
211213
);
212214
$masterInfo = $sentinel->getMasterAddrByName($masterName);
213215
if (is_array($masterInfo) && count($masterInfo) >= 2) {

tests/RedisTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ public function testShuffleNodes()
182182
$this->assertSame(3, count($nodes));
183183
}
184184

185+
public function testRedisSentinelParams()
186+
{
187+
$rel = new \ReflectionClass(\RedisSentinel::class);
188+
$method = $rel->getMethod('__construct');
189+
$count = count($method->getParameters());
190+
if ($count === 6) {
191+
$this->markTestIncomplete('RedisSentinel don\'t support auth.');
192+
}
193+
194+
$this->assertSame(7, $count);
195+
}
196+
185197
private function getRedis()
186198
{
187199
$container = $this->getContainer();

0 commit comments

Comments
 (0)