@@ -458,8 +458,6 @@ func TestClientGCIntegration(t *testing.T) {
458458 client := queue .NewTrackingClient (rdb , ttl , "tracketytrack" )
459459 require .NoError (t , client .Prepare (ctx ))
460460
461- runClientWriteIntegrationTest (ctx , t , rdb , client , true )
462-
463461 gcTrackedFields := []string {}
464462
465463 onGCFunc := func (_ context.Context , trackedFields []string ) error {
@@ -468,12 +466,39 @@ func TestClientGCIntegration(t *testing.T) {
468466 return nil
469467 }
470468
471- total , nDeleted , err := client .GC (ctx , onGCFunc )
472- require .NoError (t , err )
473- require .Equal (t , uint64 (15 ), total )
474- require .Equal (t , uint64 (10 ), nDeleted )
469+ t .Run ("full scan" , func (t * testing.T ) {
470+ gcTrackedFields = []string {}
471+
472+ require .NoError (t , rdb .FlushAll (t .Context ()).Err ())
473+
474+ runClientWriteIntegrationTest (ctx , t , rdb , client , true )
475+
476+ total , nDeleted , err := client .GC (ctx , - 1 , onGCFunc )
477+ require .NoError (t , err )
478+ require .Equal (t , uint64 (15 ), total )
479+ require .Equal (t , uint64 (10 ), nDeleted )
480+
481+ require .Len (t , gcTrackedFields , 10 )
482+ })
483+
484+ t .Run ("scoped scan" , func (t * testing.T ) {
485+ require .NoError (t , rdb .FlushAll (t .Context ()).Err ())
475486
476- require .Len (t , gcTrackedFields , 10 )
487+ runClientWriteIntegrationTest (ctx , t , rdb , client , true )
488+
489+ total , _ , err := client .GC (ctx , 6 , onGCFunc )
490+ require .NoError (t , err )
491+ require .Equal (t , uint64 (10 ), total )
492+ })
493+
494+ t .Run ("invalid nTimeDigits" , func (t * testing.T ) {
495+ require .NoError (t , rdb .FlushAll (t .Context ()).Err ())
496+
497+ runClientWriteIntegrationTest (ctx , t , rdb , client , true )
498+
499+ _ , _ , err := client .GC (ctx , 11 , onGCFunc )
500+ require .Error (t , err )
501+ })
477502}
478503
479504// TestPickupLatencyIntegration runs a test with a mostly-empty queue -- by
0 commit comments