File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -226,16 +226,15 @@ fn test_transaction_multiplexed_connection() {
226
226
. unwrap ( ) ;
227
227
}
228
228
229
- #[ test]
230
- fn test_async_scanning ( ) {
229
+ fn test_async_scanning ( batch_size : usize ) {
231
230
let ctx = TestContext :: new ( ) ;
232
231
block_on_all ( async move {
233
232
ctx. multiplexed_async_connection ( )
234
233
. and_then ( |mut con| {
235
234
async move {
236
235
let mut unseen = std:: collections:: HashSet :: new ( ) ;
237
236
238
- for x in 0 ..1000 {
237
+ for x in 0 ..batch_size {
239
238
redis:: cmd ( "SADD" )
240
239
. arg ( "foo" )
241
240
. arg ( x)
@@ -255,7 +254,8 @@ fn test_async_scanning() {
255
254
while let Some ( x) = iter. next_item ( ) . await {
256
255
// type inference limitations
257
256
let x: usize = x;
258
- unseen. remove ( & x) ;
257
+ // if this assertion fails, too many items were returned by the iterator.
258
+ assert ! ( unseen. remove( & x) ) ;
259
259
}
260
260
261
261
assert_eq ! ( unseen. len( ) , 0 ) ;
@@ -268,6 +268,16 @@ fn test_async_scanning() {
268
268
. unwrap ( ) ;
269
269
}
270
270
271
+ #[ test]
272
+ fn test_async_scanning_big_batch ( ) {
273
+ test_async_scanning ( 1000 )
274
+ }
275
+
276
+ #[ test]
277
+ fn test_async_scanning_small_batch ( ) {
278
+ test_async_scanning ( 2 )
279
+ }
280
+
271
281
#[ test]
272
282
#[ cfg( feature = "script" ) ]
273
283
fn test_script ( ) {
You can’t perform that action at this time.
0 commit comments