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

Function TestLifecycler_NilFlushTransferer

ring/lifecycler_test.go:745–769  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

743}
744
745func TestLifecycler_NilFlushTransferer(t *testing.T) {
746 t.Parallel()
747
748 ringStore, closer := consul.NewInMemoryClient(GetCodec(), log.NewNopLogger(), nil)
749 t.Cleanup(func() { assert.NoError(t, closer.Close()) })
750
751 var ringConfig Config
752 flagext.DefaultValues(&ringConfig)
753 ringConfig.KVStore.Mock = ringStore
754 lifecyclerConfig := testLifecyclerConfig(ringConfig, "ing1")
755
756 // Create a lifecycler with nil FlushTransferer to make sure it operates correctly
757 lifecycler, err := NewLifecycler(lifecyclerConfig, nil, "ingester", ringKey, true, log.NewNopLogger(), nil)
758 require.NoError(t, err)
759 require.NoError(t, services.StartAndAwaitRunning(context.Background(), lifecycler))
760
761 // Ensure the lifecycler joined the ring
762 test.Poll(t, time.Second, 1, func() interface{} {
763 return lifecycler.HealthyInstancesCount()
764 })
765
766 require.NoError(t, services.StopAndAwaitTerminated(context.Background(), lifecycler))
767
768 assert.Equal(t, 0, lifecycler.HealthyInstancesCount())
769}
770
771func TestLifecycler_TwoRingsWithDifferentKeysOnTheSameKVStore(t *testing.T) {
772 t.Parallel()

Callers

nothing calls this directly

Calls 11

HealthyInstancesCountMethod · 0.95
NewInMemoryClientFunction · 0.92
DefaultValuesFunction · 0.92
StartAndAwaitRunningFunction · 0.92
PollFunction · 0.92
StopAndAwaitTerminatedFunction · 0.92
GetCodecFunction · 0.85
testLifecyclerConfigFunction · 0.85
NewLifecyclerFunction · 0.85
CloseMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected