File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
src/test/java/redis/clients/jedis Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 11package redis .clients .jedis ;
22
3+ import static java .util .concurrent .TimeUnit .MILLISECONDS ;
4+ import static org .awaitility .Awaitility .await ;
35import static org .junit .Assert .assertEquals ;
46import static org .junit .Assert .assertNull ;
57import static org .junit .Assert .assertTrue ;
68import static org .junit .Assert .fail ;
79
810import java .net .URI ;
911import java .net .URISyntaxException ;
12+ import java .time .Duration ;
1013
1114import io .redis .test .annotations .SinceRedisVersion ;
1215import org .apache .commons .pool2 .impl .GenericObjectPoolConfig ;
@@ -268,6 +271,8 @@ public void testCloseConnectionOnMakeObject() {
268271 pool .getResource ();
269272 fail ("Should throw exception as password is incorrect." );
270273 } catch (Exception e ) {
274+ await ().pollDelay (Duration .ofMillis (10 )).atMost (50 , MILLISECONDS )
275+ .until (() -> getClientCount (jedis .clientList ()) == currentClientCount );
271276 assertEquals (currentClientCount , getClientCount (jedis .clientList ()));
272277 }
273278 }
Original file line number Diff line number Diff line change 11package redis .clients .jedis ;
22
3+ import static java .util .concurrent .TimeUnit .MILLISECONDS ;
4+ import static org .awaitility .Awaitility .await ;
35import static org .junit .Assert .assertEquals ;
46import static org .junit .Assert .assertNull ;
57import static org .junit .Assert .assertSame ;
810
911import java .net .URI ;
1012import java .net .URISyntaxException ;
13+ import java .time .Duration ;
1114import java .util .concurrent .atomic .AtomicInteger ;
1215import org .apache .commons .pool2 .PooledObject ;
1316import org .apache .commons .pool2 .PooledObjectFactory ;
@@ -400,6 +403,8 @@ public void testCloseConnectionOnMakeObject() {
400403 pool .getResource ();
401404 fail ("Should throw exception as password is incorrect." );
402405 } catch (Exception e ) {
406+ await ().pollDelay (Duration .ofMillis (10 )).atMost (50 , MILLISECONDS )
407+ .until (() -> getClientCount (jedis .clientList ()) == currentClientCount );
403408 assertEquals (currentClientCount , getClientCount (jedis .clientList ()));
404409 }
405410 }
You can’t perform that action at this time.
0 commit comments