1212import io .lettuce .core .failover .MultiDbTestSupport ;
1313import io .lettuce .core .failover .api .StatefulRedisMultiDbConnection ;
1414import io .lettuce .test .LettuceExtension ;
15+ import io .lettuce .test .resource .FastShutdown ;
16+ import io .lettuce .test .resource .TestClientResources ;
1517import io .lettuce .test .settings .TestSettings ;
1618import org .junit .jupiter .api .*;
1719import org .junit .jupiter .api .extension .ExtendWith ;
@@ -45,7 +47,7 @@ public class PingStrategyIntegrationTests extends MultiDbTestSupport {
4547
4648 private static RedisURI proxyUri2 ;
4749
48- private static TestDatabaseRawConnectionFactoryImpl connectionProvider ;
50+ private static TestDatabaseRawConnectionFactoryImpl rawConnectionFactory ;
4951
5052 @ Inject
5153 PingStrategyIntegrationTests (MultiDbClient client ) {
@@ -105,12 +107,12 @@ void resetProxies() throws IOException {
105107
106108 @ BeforeAll
107109 static void setupDatabaseConnectionProvider () {
108- connectionProvider = new TestDatabaseRawConnectionFactoryImpl ();
110+ rawConnectionFactory = new TestDatabaseRawConnectionFactoryImpl ();
109111 }
110112
111113 @ AfterAll
112114 static void cleanupDatabaseConnectionProvider () {
113- connectionProvider .close ();
115+ rawConnectionFactory .close ();
114116 }
115117
116118 @ Test
@@ -150,7 +152,7 @@ void shouldRecoverAfterDisconnect() throws Exception {
150152 RedisURI uri = RedisURI .builder ().withHost (TestSettings .host ()).withPort (9479 ).withTimeout (Duration .ofMillis (1000 ))
151153 .build ();
152154
153- PingStrategy strategy = new PingStrategy (uri , connectionProvider ,
155+ PingStrategy strategy = new PingStrategy (uri , rawConnectionFactory ,
154156 HealthCheckStrategy .Config .builder ().interval (1000 ).timeout (500 ).numProbes (1 ).build ());
155157
156158 try {
@@ -184,7 +186,7 @@ void shouldHandleConnectionTimeout() throws Exception {
184186 RedisURI uri = RedisURI .builder ().withHost (TestSettings .host ()).withPort (9479 ).withTimeout (Duration .ofMillis (100 ))
185187 .build ();
186188
187- PingStrategy strategy = new PingStrategy (uri , connectionProvider ,
189+ PingStrategy strategy = new PingStrategy (uri , rawConnectionFactory ,
188190 HealthCheckStrategy .Config .builder ().interval (1000 ).timeout (500 ).numProbes (1 ).build ());
189191
190192 try {
@@ -217,7 +219,7 @@ void shouldHandleConnectionDrop() throws Exception {
217219 RedisURI uri = RedisURI .builder ().withHost (TestSettings .host ()).withPort (9479 ).withTimeout (Duration .ofMillis (2000 ))
218220 .build ();
219221
220- PingStrategy strategy = new PingStrategy (uri , connectionProvider , HealthCheckStrategy .Config .create ());
222+ PingStrategy strategy = new PingStrategy (uri , rawConnectionFactory , HealthCheckStrategy .Config .create ());
221223
222224 try {
223225 // When: Initial health check
@@ -357,7 +359,7 @@ private static class TestDatabaseRawConnectionFactoryImpl implements DatabaseRaw
357359 private final RedisClient client ;
358360
359361 public TestDatabaseRawConnectionFactoryImpl () {
360- this .client = RedisClient .create ();
362+ this .client = RedisClient .create (TestClientResources . get () );
361363 }
362364
363365 @ Override
@@ -366,7 +368,7 @@ public TestDatabaseRawConnectionFactoryImpl() {
366368 }
367369
368370 public void close () {
369- client .shutdown ();
371+ FastShutdown .shutdown (client );
370372 }
371373
372374 }
0 commit comments