@@ -776,6 +776,7 @@ func TestRestartIngester_READONLY(t *testing.T) {
776
776
// Starts Ingester and wait it to became active
777
777
startIngesterAndWaitState := func (ingId string , addr string , expectedState InstanceState ) * Lifecycler {
778
778
lifecyclerConfig := testLifecyclerConfigWithAddr (ringConfig , ingId , addr )
779
+ lifecyclerConfig .UnregisterOnShutdown = false
779
780
lifecycler , err := NewLifecycler (lifecyclerConfig , & noopFlushTransferer {}, "lifecycler" , ringKey , true , true , log .NewNopLogger (), nil )
780
781
require .NoError (t , err )
781
782
require .NoError (t , services .StartAndAwaitRunning (context .Background (), lifecycler ))
@@ -786,10 +787,7 @@ func TestRestartIngester_READONLY(t *testing.T) {
786
787
}
787
788
788
789
l1 := startIngesterAndWaitState ("ing1" , "0.0.0.0" , ACTIVE )
789
- defer services .StopAndAwaitTerminated (context .Background (), l1 ) //nolint:errcheck
790
-
791
790
l2 := startIngesterAndWaitState ("ing2" , "0.0.0.0" , ACTIVE )
792
- defer services .StopAndAwaitTerminated (context .Background (), l2 ) //nolint:errcheck
793
791
794
792
err = l2 .ChangeState (context .Background (), READONLY )
795
793
require .NoError (t , err )
@@ -818,10 +816,10 @@ func TestRestartIngester_READONLY(t *testing.T) {
818
816
assert .Equal (t , READONLY , ingesters ["ing2" ].State )
819
817
820
818
// 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
822
820
823
821
// 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
825
823
826
824
ingesters = poll (func (desc * Desc ) bool {
827
825
return len (desc .Ingesters ) == 2 && desc .Ingesters ["ing1" ].State == ACTIVE
0 commit comments