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