1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-13 13:59:40 +00:00

Use limit=-1 to disable default list limit

The default chunk size in the partition was set to 100000. It could be
overridden as a larger or smaller number, but not disabled altogether.
This change adds the ability for users to explicitly opt out of the
limit by specifying a negative number or zero. The default behavior is
the same.
This commit is contained in:
Colleen Murphy
2022-12-07 14:39:05 -08:00
parent 1a360d705a
commit 7c0228e575
4 changed files with 49 additions and 7 deletions

View File

@@ -77,6 +77,7 @@ func TestList(t *testing.T) {
newRequest("limit=1", "user1"),
newRequest(fmt.Sprintf("limit=1&continue=%s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf(`{"p":"all","c":"%s","l":1}`, base64.StdEncoding.EncodeToString([]byte("granny-smith")))))), "user1"),
newRequest(fmt.Sprintf("limit=1&continue=%s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf(`{"p":"all","c":"%s","l":1}`, base64.StdEncoding.EncodeToString([]byte("crispin")))))), "user1"),
newRequest("limit=-1", "user1"),
},
access: []map[string]string{
{
@@ -88,6 +89,9 @@ func TestList(t *testing.T) {
{
"user1": "roleA",
},
{
"user1": "roleA",
},
},
partitions: map[string][]Partition{
"user1": {
@@ -126,6 +130,14 @@ func TestList(t *testing.T) {
newApple("crispin").toObj(),
},
},
{
Count: 3,
Objects: []types.APIObject{
newApple("fuji").toObj(),
newApple("granny-smith").toObj(),
newApple("crispin").toObj(),
},
},
},
},
{