diff --git a/kv/consul/mock.go b/kv/consul/mock.go index e2f434b61..ec848e135 100644 --- a/kv/consul/mock.go +++ b/kv/consul/mock.go @@ -15,6 +15,9 @@ import ( "github.com/grafana/dskit/kv/codec" ) +// The max wait time allowed for mockKV operations, in order to have faster tests. +const maxWaitTime = 100 * time.Millisecond + type mockKV struct { mtx sync.Mutex cond *sync.Cond @@ -87,7 +90,7 @@ func (m *mockKV) loop() { select { case <-m.close: return - case <-time.After(time.Second): + case <-time.After(maxWaitTime): m.mtx.Lock() m.cond.Broadcast() m.mtx.Unlock() @@ -258,7 +261,6 @@ func (m *mockKV) ResetIndexForKey(key string) { // mockedMaxWaitTime returns the minimum duration between the input duration // and the max wait time allowed in this mock, in order to have faster tests. func mockedMaxWaitTime(queryWaitTime time.Duration) time.Duration { - const maxWaitTime = time.Second if queryWaitTime > maxWaitTime { return maxWaitTime }