diff --git a/pkg/ingester/ingester_test.go b/pkg/ingester/ingester_test.go index 86434beb4f..1ee6b41b1a 100644 --- a/pkg/ingester/ingester_test.go +++ b/pkg/ingester/ingester_test.go @@ -5315,12 +5315,14 @@ func Test_Ingester_ModeHandler(t *testing.T) { require.Equal(t, testData.expectedResponse, response.Code) require.Equal(t, testData.expectedState, i.lifecycler.GetState()) - - err = i.CheckReady(context.Background()) if testData.expectedIsReady { - require.NoError(t, err) + // Wait for instance to own tokens + test.Poll(t, 1*time.Second, nil, func() interface{} { + return i.CheckReady(context.Background()) + }) + require.NoError(t, i.CheckReady(context.Background())) } else { - require.NotNil(t, err) + require.NotNil(t, i.CheckReady(context.Background())) } }) }