Resolve Redis Client Connection Issue in Integration Test
- Resolves a race condition where a client instance is closed before it can be used by another test
This commit is contained in:
parent
125c07509d
commit
61787725fa
|
@ -145,5 +145,10 @@ public class RedisClient {
|
|||
log.error("Exception caught in flushAll", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void destroyInstance() {
|
||||
jedisPool = null;
|
||||
instance = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,13 +25,14 @@ public class NaiveApproachIntegrationTest {
|
|||
s.close();
|
||||
|
||||
redisServer = new RedisServer(port);
|
||||
redisServer.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void destroy() {
|
||||
if (redisServer.isActive())
|
||||
if (redisServer.isActive()) {
|
||||
redisServer.stop();
|
||||
redisClient.destroyInstance();
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -32,13 +32,14 @@ public class ScanStrategyIntegrationTest {
|
|||
s.close();
|
||||
|
||||
redisServer = new RedisServer(port);
|
||||
redisServer.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void destroy() {
|
||||
if (redisServer.isActive())
|
||||
if (redisServer.isActive()) {
|
||||
redisServer.stop();
|
||||
redisClient.destroyInstance();
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
Loading…
Reference in New Issue