15720: Merge branch 'master' into 15720-fed-user-list
[arvados.git] / lib / controller / federation / list_test.go
index 5a630a9450ef861ed7c91c5f001f3fa642378638..a9c4f588f12a38b017d1c89b2995263a8c12d3d6 100644 (file)
@@ -8,6 +8,7 @@ import (
        "context"
        "fmt"
        "net/http"
+       "sort"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/arvadostest"
@@ -365,10 +366,13 @@ func (s *CollectionListSuite) test(c *check.C, trial listTrial) {
                c.Logf("returned error string is %q", err)
        } else {
                c.Check(err, check.IsNil)
-               var expectItems []arvados.Collection
+               expectItems := []arvados.Collection{}
                for _, uuid := range trial.expectUUIDs {
                        expectItems = append(expectItems, arvados.Collection{UUID: uuid})
                }
+               // expectItems is sorted by UUID, so sort resp.Items
+               // by UUID before checking DeepEquals.
+               sort.Slice(resp.Items, func(i, j int) bool { return resp.Items[i].UUID < resp.Items[j].UUID })
                c.Check(resp, check.DeepEquals, arvados.CollectionList{
                        Items: expectItems,
                })