Browse Source

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

pull/7262/head
R.B. Boyer 5 years ago committed by GitHub
parent
commit
12876983cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      agent/cache/cache_test.go

3
agent/cache/cache_test.go vendored

@ -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 {

Loading…
Cancel
Save