Skip to content

Commit 7029dee

Browse files
committed
fix test
Signed-off-by: Daniel Deluiggi <[email protected]>
1 parent a5b96b9 commit 7029dee

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pkg/ring/lifecycler_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ func TestRestartIngester_READONLY(t *testing.T) {
776776
// Starts Ingester and wait it to became active
777777
startIngesterAndWaitState := func(ingId string, addr string, expectedState InstanceState) *Lifecycler {
778778
lifecyclerConfig := testLifecyclerConfigWithAddr(ringConfig, ingId, addr)
779+
lifecyclerConfig.UnregisterOnShutdown = false
779780
lifecycler, err := NewLifecycler(lifecyclerConfig, &noopFlushTransferer{}, "lifecycler", ringKey, true, true, log.NewNopLogger(), nil)
780781
require.NoError(t, err)
781782
require.NoError(t, services.StartAndAwaitRunning(context.Background(), lifecycler))
@@ -786,10 +787,7 @@ func TestRestartIngester_READONLY(t *testing.T) {
786787
}
787788

788789
l1 := startIngesterAndWaitState("ing1", "0.0.0.0", ACTIVE)
789-
defer services.StopAndAwaitTerminated(context.Background(), l1) //nolint:errcheck
790-
791790
l2 := startIngesterAndWaitState("ing2", "0.0.0.0", ACTIVE)
792-
defer services.StopAndAwaitTerminated(context.Background(), l2) //nolint:errcheck
793791

794792
err = l2.ChangeState(context.Background(), READONLY)
795793
require.NoError(t, err)
@@ -818,10 +816,10 @@ func TestRestartIngester_READONLY(t *testing.T) {
818816
assert.Equal(t, READONLY, ingesters["ing2"].State)
819817

820818
// Start Ingester1 again - Should flip back to ACTIVE in the ring
821-
l1 = startIngesterAndWaitState("ing1", "0.0.0.0", ACTIVE)
819+
defer services.StopAndAwaitTerminated(context.Background(), startIngesterAndWaitState("ing1", "0.0.0.0", ACTIVE)) //nolint:errcheck
822820

823821
// Start Ingester2 again - Should keep on READONLY
824-
l2 = startIngesterAndWaitState("ing2", "0.0.0.0", READONLY)
822+
defer services.StopAndAwaitTerminated(context.Background(), startIngesterAndWaitState("ing2", "0.0.0.0", READONLY)) //nolint:errcheck
825823

826824
ingesters = poll(func(desc *Desc) bool {
827825
return len(desc.Ingesters) == 2 && desc.Ingesters["ing1"].State == ACTIVE

0 commit comments

Comments
 (0)