MCPcopy
hub / github.com/grafana/dskit / waitRingInstance

Function waitRingInstance

ring/lifecycler_test.go:2005–2024  ·  view source on GitHub ↗
(t *testing.T, timeout time.Duration, l *Lifecycler, check func(instance InstanceDesc) error)

Source from the content-addressed store, hash-verified

2003}
2004
2005func 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
2026func TestDefaultFinalSleepValue(t *testing.T) {
2027 t.Parallel()

Callers 2

Calls 2

PollFunction · 0.92
GetMethod · 0.65

Tested by

no test coverage detected