1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
11 check "gopkg.in/check.v1"
14 var _ = check.Suite(&ThrottleSuite{})
16 type ThrottleSuite struct{}
18 func (s *ThrottleSuite) TestRateLimitError(c *check.C) {
20 c.Check(t.Error(), check.IsNil)
21 t.ErrorUntil(errors.New("wait"), time.Now().Add(time.Second), nil)
22 c.Check(t.Error(), check.NotNil)
23 t.ErrorUntil(nil, time.Now(), nil)
24 c.Check(t.Error(), check.IsNil)
27 t.ErrorUntil(errors.New("wait"), time.Now().Add(time.Millisecond), func() { notified = true })
28 c.Check(t.Error(), check.NotNil)
29 time.Sleep(time.Millisecond * 10)
30 c.Check(t.Error(), check.IsNil)
31 c.Check(notified, check.Equals, true)