16263: Adds test exposing a bug when using 'limit' with the max int64 value.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Wed, 25 Mar 2020 14:26:55 +0000 (11:26 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Wed, 25 Mar 2020 14:26:55 +0000 (11:26 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

lib/controller/integration_test.go
sdk/go/arvados/api.go

index 19dd4e1ad2b352f1149653253e4df6598fb1fe12..d2ae1f6fbb33ad7dbcc4cc3151b8e7a06e64c490 100644 (file)
@@ -8,6 +8,7 @@ import (
        "bytes"
        "context"
        "io"
+       "math"
        "net"
        "net/url"
        "os"
@@ -252,3 +253,23 @@ func (s *IntegrationSuite) TestListUsers(c *check.C) {
        _, err = conn3.UserList(rootctx1, arvados.ListOptions{Limit: -1})
        c.Assert(err, check.IsNil, check.Commentf("getting user list: %q", err))
 }
+
+// Test for bug #16263
+func (s *IntegrationSuite) TestListUsersWithMaxLimit(c *check.C) {
+       rootctx1, _, _ := s.rootClients("z1111")
+       conn3 := s.conn("z3333")
+       maxLimit := int64(math.MaxInt64)
+
+       // Make sure LoginCluster is properly configured
+       for cls := range s.testClusters {
+               c.Check(
+                       s.testClusters[cls].config.Clusters[cls].Login.LoginCluster,
+                       check.Equals, "z1111",
+                       check.Commentf("incorrect LoginCluster config on cluster %q", cls))
+       }
+
+       // Ask for the user list on z3333 using z1111's system root token and
+       // limit: max int64 value.
+       _, err := conn3.UserList(rootctx1, arvados.ListOptions{Limit: maxLimit})
+       c.Assert(err, check.IsNil, check.Commentf("getting user list: %q", err))
+}
index 0c5d32e8b7e1e96bdab9bbf45b25962963297829..4eb5b61b3a1200e46119c1c15e7823a4496be64a 100644 (file)
@@ -77,8 +77,8 @@ type ListOptions struct {
        Select             []string               `json:"select"`
        Filters            []Filter               `json:"filters"`
        Where              map[string]interface{} `json:"where"`
-       Limit              int                    `json:"limit"`
-       Offset             int                    `json:"offset"`
+       Limit              int64                  `json:"limit"`
+       Offset             int64                  `json:"offset"`
        Order              []string               `json:"order"`
        Distinct           bool                   `json:"distinct"`
        Count              string                 `json:"count"`