mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-16 07:06:45 +00:00
Fix flaky store cooldown test
This commit is contained in:
committed by
James Houlahan
parent
cc14b523cb
commit
8cdebb6d05
@ -16,6 +16,8 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
||||
* GODT-390 Don't logout user if AuthRefresh fails because internet was off.
|
||||
* GODT-358 Bad timeouts with Alternative Routing
|
||||
|
||||
* GODT-390 Don't logout user if AuthRefresh fails because internet was off
|
||||
* GODT-341 Fixed flaky unittest for Store synchronization cooldown
|
||||
|
||||
## [v1.2.7] Donghai-hotfix - beta (2020-05-07)
|
||||
|
||||
|
||||
@ -117,17 +117,16 @@ func TestCooldownIncreaseAndReset(t *testing.T) {
|
||||
func TestCooldownNotSooner(t *testing.T) {
|
||||
var testCooldown cooldown
|
||||
waitTime := 100 * time.Millisecond
|
||||
retries := int64(10)
|
||||
retryWait := time.Duration(waitTime.Milliseconds()/retries) * time.Millisecond
|
||||
testCooldown.setWaitTimes(waitTime)
|
||||
|
||||
// first time it should never be too soon
|
||||
// First time it should never be too soon.
|
||||
assert.False(t, testCooldown.isTooSoon())
|
||||
// these retries should be too soon
|
||||
for i := retries; i > 0; i-- {
|
||||
|
||||
// Only half of given wait time should be too soon.
|
||||
time.Sleep(waitTime / 2)
|
||||
assert.True(t, testCooldown.isTooSoon())
|
||||
time.Sleep(retryWait)
|
||||
}
|
||||
// after given wait time it shouldn't be soon anymore
|
||||
|
||||
// After given wait time it shouldn't be soon anymore.
|
||||
time.Sleep(waitTime / 2)
|
||||
assert.False(t, testCooldown.isTooSoon())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user