mirror of
https://github.com/rclone/rclone
synced 2024-11-16 16:15:34 +01:00
seafile: use atomic types
This commit is contained in:
parent
a56c11753a
commit
c624dd5c3a
@ -17,17 +17,17 @@ func TestShouldAllowShutdownTwice(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRenewalInTimeLimit(t *testing.T) {
|
func TestRenewalInTimeLimit(t *testing.T) {
|
||||||
var count int64
|
var count atomic.Int64
|
||||||
|
|
||||||
renew := NewRenew(100*time.Millisecond, func() error {
|
renew := NewRenew(100*time.Millisecond, func() error {
|
||||||
atomic.AddInt64(&count, 1)
|
count.Add(1)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
renew.Shutdown()
|
renew.Shutdown()
|
||||||
|
|
||||||
// there's no guarantee the CI agent can handle a simple goroutine
|
// there's no guarantee the CI agent can handle a simple goroutine
|
||||||
renewCount := atomic.LoadInt64(&count)
|
renewCount := count.Load()
|
||||||
t.Logf("renew count = %d", renewCount)
|
t.Logf("renew count = %d", renewCount)
|
||||||
assert.Greater(t, renewCount, int64(0))
|
assert.Greater(t, renewCount, int64(0))
|
||||||
assert.Less(t, renewCount, int64(11))
|
assert.Less(t, renewCount, int64(11))
|
||||||
|
Loading…
Reference in New Issue
Block a user