@@ -1493,6 +1493,73 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
1493
1493
expectContinueExact : encodeContinueOrDie (createdPods [1 ].Namespace + "/" + createdPods [1 ].Name + "\x00 " , int64 (continueRV + 1 )),
1494
1494
expectedRemainingItemCount : utilpointer .Int64 (3 ),
1495
1495
},
1496
+ {
1497
+ name : "test List with continue from second pod, negative resource version gives consistent read" ,
1498
+ prefix : "/pods/" ,
1499
+ pred : storage.SelectionPredicate {
1500
+ Label : labels .Everything (),
1501
+ Field : fields .Everything (),
1502
+ Continue : encodeContinueOrDie (createdPods [0 ].Namespace + "/" + createdPods [0 ].Name + "\x00 " , - 1 ),
1503
+ },
1504
+ expectedOut : []example.Pod {* createdPods [1 ], * createdPods [2 ], * createdPods [3 ], * createdPods [4 ]},
1505
+ expectRV : currentRV ,
1506
+ },
1507
+ {
1508
+ name : "test List with continue from second pod and limit, negative resource version gives consistent read" ,
1509
+ prefix : "/pods/" ,
1510
+ pred : storage.SelectionPredicate {
1511
+ Label : labels .Everything (),
1512
+ Field : fields .Everything (),
1513
+ Limit : 2 ,
1514
+ Continue : encodeContinueOrDie (createdPods [0 ].Namespace + "/" + createdPods [0 ].Name + "\x00 " , - 1 ),
1515
+ },
1516
+ expectedOut : []example.Pod {* createdPods [1 ], * createdPods [2 ]},
1517
+ expectContinue : true ,
1518
+ expectContinueExact : encodeContinueOrDie (createdPods [2 ].Namespace + "/" + createdPods [2 ].Name + "\x00 " , int64 (continueRV + 1 )),
1519
+ expectRV : currentRV ,
1520
+ expectedRemainingItemCount : utilpointer .Int64 (2 ),
1521
+ },
1522
+ {
1523
+ name : "test List with continue from third pod, negative resource version gives consistent read" ,
1524
+ prefix : "/pods/" ,
1525
+ pred : storage.SelectionPredicate {
1526
+ Label : labels .Everything (),
1527
+ Field : fields .Everything (),
1528
+ Continue : encodeContinueOrDie (createdPods [2 ].Namespace + "/" + createdPods [2 ].Name + "\x00 " , - 1 ),
1529
+ },
1530
+ expectedOut : []example.Pod {* createdPods [3 ], * createdPods [4 ]},
1531
+ expectRV : currentRV ,
1532
+ },
1533
+ {
1534
+ name : "test List with continue from empty fails" ,
1535
+ prefix : "/pods/" ,
1536
+ pred : storage.SelectionPredicate {
1537
+ Label : labels .Everything (),
1538
+ Field : fields .Everything (),
1539
+ Continue : encodeContinueOrDie ("" , int64 (continueRV )),
1540
+ },
1541
+ expectError : true ,
1542
+ },
1543
+ {
1544
+ name : "test List with continue from first pod, empty resource version fails" ,
1545
+ prefix : "/pods/" ,
1546
+ pred : storage.SelectionPredicate {
1547
+ Label : labels .Everything (),
1548
+ Field : fields .Everything (),
1549
+ Continue : encodeContinueOrDie (createdPods [0 ].Namespace + "/" + createdPods [0 ].Name + "\x00 " , 0 ),
1550
+ },
1551
+ expectError : true ,
1552
+ },
1553
+ {
1554
+ name : "test List with negative rv fails" ,
1555
+ prefix : "/pods/" ,
1556
+ rv : "-1" ,
1557
+ pred : storage.SelectionPredicate {
1558
+ Label : labels .Everything (),
1559
+ Field : fields .Everything (),
1560
+ },
1561
+ expectError : true ,
1562
+ },
1496
1563
}
1497
1564
1498
1565
for _ , tt := range tests {
0 commit comments