(t *testing.T, timeout time.Duration, l *Lifecycler, check func(instance InstanceDesc) error)
| 2003 | } |
| 2004 | |
| 2005 | func waitRingInstance(t *testing.T, timeout time.Duration, l *Lifecycler, check func(instance InstanceDesc) error) { |
| 2006 | test.Poll(t, timeout, nil, func() interface{} { |
| 2007 | desc, err := l.KVStore.Get(context.Background(), l.RingKey) |
| 2008 | if err != nil { |
| 2009 | return err |
| 2010 | } |
| 2011 | |
| 2012 | ringDesc, ok := desc.(*Desc) |
| 2013 | if !ok || ringDesc == nil { |
| 2014 | return errors.New("empty ring") |
| 2015 | } |
| 2016 | |
| 2017 | instance, ok := ringDesc.Ingesters[l.ID] |
| 2018 | if !ok { |
| 2019 | return errors.New("no instance in the ring") |
| 2020 | } |
| 2021 | |
| 2022 | return check(instance) |
| 2023 | }) |
| 2024 | } |
| 2025 | |
| 2026 | func TestDefaultFinalSleepValue(t *testing.T) { |
| 2027 | t.Parallel() |
no test coverage detected