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 1
1
package redis .clients .jedis ;
2
2
3
+ import static java .util .concurrent .TimeUnit .MILLISECONDS ;
4
+ import static org .awaitility .Awaitility .await ;
3
5
import static org .junit .Assert .assertEquals ;
4
6
import static org .junit .Assert .assertNull ;
5
7
import static org .junit .Assert .assertTrue ;
6
8
import static org .junit .Assert .fail ;
7
9
8
10
import java .net .URI ;
9
11
import java .net .URISyntaxException ;
12
+ import java .time .Duration ;
10
13
11
14
import io .redis .test .annotations .SinceRedisVersion ;
12
15
import org .apache .commons .pool2 .impl .GenericObjectPoolConfig ;
@@ -268,6 +271,8 @@ public void testCloseConnectionOnMakeObject() {
268
271
pool .getResource ();
269
272
fail ("Should throw exception as password is incorrect." );
270
273
} catch (Exception e ) {
274
+ await ().pollDelay (Duration .ofMillis (10 )).atMost (50 , MILLISECONDS )
275
+ .until (() -> getClientCount (jedis .clientList ()) == currentClientCount );
271
276
assertEquals (currentClientCount , getClientCount (jedis .clientList ()));
272
277
}
273
278
}
Original file line number Diff line number Diff line change 1
1
package redis .clients .jedis ;
2
2
3
+ import static java .util .concurrent .TimeUnit .MILLISECONDS ;
4
+ import static org .awaitility .Awaitility .await ;
3
5
import static org .junit .Assert .assertEquals ;
4
6
import static org .junit .Assert .assertNull ;
5
7
import static org .junit .Assert .assertSame ;
8
10
9
11
import java .net .URI ;
10
12
import java .net .URISyntaxException ;
13
+ import java .time .Duration ;
11
14
import java .util .concurrent .atomic .AtomicInteger ;
12
15
import org .apache .commons .pool2 .PooledObject ;
13
16
import org .apache .commons .pool2 .PooledObjectFactory ;
@@ -400,6 +403,8 @@ public void testCloseConnectionOnMakeObject() {
400
403
pool .getResource ();
401
404
fail ("Should throw exception as password is incorrect." );
402
405
} catch (Exception e ) {
406
+ await ().pollDelay (Duration .ofMillis (10 )).atMost (50 , MILLISECONDS )
407
+ .until (() -> getClientCount (jedis .clientList ()) == currentClientCount );
403
408
assertEquals (currentClientCount , getClientCount (jedis .clientList ()));
404
409
}
405
410
}
You can’t perform that action at this time.
0 commit comments