@@ -201,6 +201,7 @@ func TestGetListCacheBypass(t *testing.T) {
201
201
{opts : storage.ListOptions {ResourceVersion : "0" , Predicate : storage.SelectionPredicate {Continue : "a" }}, expectBypass : true },
202
202
{opts : storage.ListOptions {ResourceVersion : "1" , Predicate : storage.SelectionPredicate {Continue : "a" }}, expectBypass : true },
203
203
204
+ {opts : storage.ListOptions {ResourceVersion : "" , Predicate : storage.SelectionPredicate {Limit : 500 }}, expectBypass : true },
204
205
{opts : storage.ListOptions {ResourceVersion : "0" , Predicate : storage.SelectionPredicate {Limit : 500 }}, expectBypass : false },
205
206
{opts : storage.ListOptions {ResourceVersion : "1" , Predicate : storage.SelectionPredicate {Limit : 500 }}, expectBypass : true },
206
207
@@ -213,7 +214,6 @@ func TestGetListCacheBypass(t *testing.T) {
213
214
featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .ConsistentListFromCache , false )
214
215
testCases := append (commonTestCases ,
215
216
testCase {opts : storage.ListOptions {ResourceVersion : "" }, expectBypass : true },
216
- testCase {opts : storage.ListOptions {ResourceVersion : "" , Predicate : storage.SelectionPredicate {Limit : 500 }}, expectBypass : true },
217
217
)
218
218
for _ , tc := range testCases {
219
219
testGetListCacheBypass (t , tc .opts , tc .expectBypass )
@@ -233,7 +233,6 @@ func TestGetListCacheBypass(t *testing.T) {
233
233
234
234
testCases := append (commonTestCases ,
235
235
testCase {opts : storage.ListOptions {ResourceVersion : "" }, expectBypass : false },
236
- testCase {opts : storage.ListOptions {ResourceVersion : "" , Predicate : storage.SelectionPredicate {Limit : 500 }}, expectBypass : false },
237
236
)
238
237
for _ , tc := range testCases {
239
238
testGetListCacheBypass (t , tc .opts , tc .expectBypass )
@@ -2567,63 +2566,6 @@ func TestWatchStreamSeparation(t *testing.T) {
2567
2566
}
2568
2567
}
2569
2568
2570
- func TestComputeListLimit (t * testing.T ) {
2571
- scenarios := []struct {
2572
- name string
2573
- opts storage.ListOptions
2574
- expectedLimit int64
2575
- }{
2576
- {
2577
- name : "limit is zero" ,
2578
- opts : storage.ListOptions {
2579
- Predicate : storage.SelectionPredicate {
2580
- Limit : 0 ,
2581
- },
2582
- },
2583
- expectedLimit : 0 ,
2584
- },
2585
- {
2586
- name : "limit is positive, RV is unset" ,
2587
- opts : storage.ListOptions {
2588
- Predicate : storage.SelectionPredicate {
2589
- Limit : 1 ,
2590
- },
2591
- ResourceVersion : "" ,
2592
- },
2593
- expectedLimit : 1 ,
2594
- },
2595
- {
2596
- name : "limit is positive, RV = 100" ,
2597
- opts : storage.ListOptions {
2598
- Predicate : storage.SelectionPredicate {
2599
- Limit : 1 ,
2600
- },
2601
- ResourceVersion : "100" ,
2602
- },
2603
- expectedLimit : 1 ,
2604
- },
2605
- {
2606
- name : "legacy case: limit is positive, RV = 0" ,
2607
- opts : storage.ListOptions {
2608
- Predicate : storage.SelectionPredicate {
2609
- Limit : 1 ,
2610
- },
2611
- ResourceVersion : "0" ,
2612
- },
2613
- expectedLimit : 0 ,
2614
- },
2615
- }
2616
-
2617
- for _ , scenario := range scenarios {
2618
- t .Run (scenario .name , func (t * testing.T ) {
2619
- actualLimit := computeListLimit (scenario .opts )
2620
- if actualLimit != scenario .expectedLimit {
2621
- t .Errorf ("computeListLimit returned = %v, expected %v" , actualLimit , scenario .expectedLimit )
2622
- }
2623
- })
2624
- }
2625
- }
2626
-
2627
2569
func watchAndWaitForBookmark (t * testing.T , ctx context.Context , etcdStorage storage.Interface ) func () (resourceVersion uint64 ) {
2628
2570
opts := storage.ListOptions {ResourceVersion : "" , Predicate : storage .Everything , Recursive : true }
2629
2571
opts .Predicate .AllowWatchBookmarks = true
0 commit comments