@@ -92,6 +92,15 @@ public function testRedisConnectionConfig()
92
92
], $ config );
93
93
}
94
94
95
+ public function testRedisPoolConfig ()
96
+ {
97
+ $ pool = $ this ->getRedisPool ();
98
+
99
+ $ config = $ pool ->getConfig ();
100
+
101
+ $ this ->assertSame ($ this ->getDefaultPoolConfig (), $ config );
102
+ }
103
+
95
104
public function testRedisConnectionReconnect ()
96
105
{
97
106
$ pool = $ this ->getRedisPool ();
@@ -147,43 +156,48 @@ public function testRedisCloseInLowFrequency()
147
156
$ connection ->release ();
148
157
}
149
158
159
+ private function getDefaultPoolConfig ()
160
+ {
161
+ return [
162
+ 'host ' => 'redis ' ,
163
+ 'auth ' => 'redis ' ,
164
+ 'port ' => 16379 ,
165
+ 'read_timeout ' => 3.0 ,
166
+ 'reserved ' => null ,
167
+ 'retry_interval ' => 5 ,
168
+ 'context ' => [
169
+ 'stream ' => ['cafile ' => 'foo-cafile ' , 'verify_peer ' => true ],
170
+ ],
171
+ 'pool ' => [
172
+ 'min_connections ' => 1 ,
173
+ 'max_connections ' => 30 ,
174
+ 'connect_timeout ' => 10.0 ,
175
+ 'wait_timeout ' => 3.0 ,
176
+ 'heartbeat ' => -1 ,
177
+ 'max_idle_time ' => 1 ,
178
+ ],
179
+ 'cluster ' => [
180
+ 'enable ' => false ,
181
+ 'name ' => null ,
182
+ 'seeds ' => [
183
+ '127.0.0.1:6379 ' ,
184
+ ],
185
+ 'context ' => [
186
+ 'stream ' => ['cafile ' => 'foo-cafile ' , 'verify_peer ' => true ],
187
+ ],
188
+ ],
189
+ 'sentinel ' => [
190
+ 'enable ' => false ,
191
+ ],
192
+ ];
193
+ }
194
+
150
195
private function getRedisPool ()
151
196
{
152
197
$ container = Mockery::mock (Container::class);
153
198
$ container ->shouldReceive ('get ' )->with (ConfigInterface::class)->andReturn (new Config ([
154
199
'redis ' => [
155
- 'default ' => [
156
- 'host ' => 'redis ' ,
157
- 'auth ' => 'redis ' ,
158
- 'port ' => 16379 ,
159
- 'read_timeout ' => 3.0 ,
160
- 'reserved ' => null ,
161
- 'retry_interval ' => 5 ,
162
- 'context ' => [
163
- 'stream ' => ['cafile ' => 'foo-cafile ' , 'verify_peer ' => true ],
164
- ],
165
- 'pool ' => [
166
- 'min_connections ' => 1 ,
167
- 'max_connections ' => 30 ,
168
- 'connect_timeout ' => 10.0 ,
169
- 'wait_timeout ' => 3.0 ,
170
- 'heartbeat ' => -1 ,
171
- 'max_idle_time ' => 1 ,
172
- ],
173
- 'cluster ' => [
174
- 'enable ' => false ,
175
- 'name ' => null ,
176
- 'seeds ' => [
177
- '127.0.0.1:6379 ' ,
178
- ],
179
- 'context ' => [
180
- 'stream ' => ['cafile ' => 'foo-cafile ' , 'verify_peer ' => true ],
181
- ],
182
- ],
183
- 'sentinel ' => [
184
- 'enable ' => false ,
185
- ],
186
- ],
200
+ 'default ' => $ this ->getDefaultPoolConfig (),
187
201
],
188
202
]));
189
203
0 commit comments