avoid 'panic: Log in goroutine after TestCacheGet_refreshAge has completed' (#7276)

This commit is contained in:
R.B. Boyer 2020-02-12 10:01:51 -06:00 committed by GitHub
parent 80b1165976
commit 12876983cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 3 deletions

View File

@ -934,15 +934,12 @@ func TestCacheGet_refreshAge(t *testing.T) {
Return(func(o FetchOptions, r Request) FetchResult {
idx := atomic.LoadUint64(&index)
if atomic.LoadUint64(&shouldFail) == 1 {
t.Logf("Failing Fetch at index %d", idx)
return FetchResult{Value: nil, Index: idx}
}
if o.MinIndex == idx {
t.Logf("Sleeping Fetch at index %d", idx)
// Simulate waiting for a new value
time.Sleep(5 * time.Millisecond)
}
t.Logf("Returning Fetch at index %d", idx)
return FetchResult{Value: int(idx * 2), Index: idx}
}, func(o FetchOptions, r Request) error {
if atomic.LoadUint64(&shouldFail) == 1 {