1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 "git.arvados.org/arvados.git/sdk/go/arvados"
13 check "gopkg.in/check.v1"
16 // TestIdenticalTimestamps ensures EachCollection returns the same
17 // set of collections for various page sizes -- even page sizes so
18 // small that we get entire pages full of collections with identical
19 // timestamps and exercise our gettingExactTimestamp cases.
20 func (s *integrationSuite) TestIdenticalTimestamps(c *check.C) {
21 // pageSize==0 uses the default (large) page size.
22 pageSizes := []int{0, 2, 3, 4, 5}
23 got := make([][]string, len(pageSizes))
25 for trial, pageSize := range pageSizes {
27 go func(trial, pageSize int) {
32 sawUUID := make(map[string]bool)
33 err := EachCollection(context.Background(), s.client, pageSize, func(c arvados.Collection) error {
34 if c.ModifiedAt.IsZero() {
41 got[trial] = append(got[trial], c.UUID)
42 sawUUID[c.UUID] = true
43 if lastMod == c.ModifiedAt {
45 if streak > longestStreak {
46 longestStreak = streak
50 lastMod = c.ModifiedAt
54 c.Check(err, check.IsNil)
55 c.Check(longestStreak > 25, check.Equals, true)
59 for trial := 1; trial < len(pageSizes); trial++ {
60 c.Check(got[trial], check.DeepEquals, got[0])