(t *testing.T, cfg Config, heartbeat time.Duration, lifecyclerID int, zones int)
| 4040 | } |
| 4041 | |
| 4042 | func startLifecycler(t *testing.T, cfg Config, heartbeat time.Duration, lifecyclerID int, zones int) *Lifecycler { |
| 4043 | lcCfg := LifecyclerConfig{ |
| 4044 | RingConfig: cfg, |
| 4045 | NumTokens: 16, |
| 4046 | HeartbeatPeriod: heartbeat, |
| 4047 | HeartbeatTimeout: time.Minute, |
| 4048 | ObservePeriod: 0, |
| 4049 | JoinAfter: 0, |
| 4050 | Zone: fmt.Sprintf("zone-%d", lifecyclerID%zones), |
| 4051 | Addr: fmt.Sprintf("addr-%d", lifecyclerID), |
| 4052 | ID: fmt.Sprintf("instance-%d", lifecyclerID), |
| 4053 | UnregisterOnShutdown: true, |
| 4054 | } |
| 4055 | |
| 4056 | lc, err := NewLifecycler(lcCfg, &noopFlushTransferer{}, "test", "test", false, log.NewNopLogger(), nil) |
| 4057 | require.NoError(t, err) |
| 4058 | |
| 4059 | lc.AddListener(services.NewListener(nil, nil, nil, nil, func(_ services.State, failure error) { |
| 4060 | t.Log("lifecycler", lifecyclerID, "failed:", failure) |
| 4061 | t.Fail() |
| 4062 | })) |
| 4063 | |
| 4064 | require.NoError(t, services.StartAndAwaitRunning(context.Background(), lc)) |
| 4065 | |
| 4066 | t.Cleanup(func() { |
| 4067 | _ = services.StopAndAwaitTerminated(context.Background(), lc) |
| 4068 | }) |
| 4069 | |
| 4070 | return lc |
| 4071 | } |
| 4072 | |
| 4073 | // This test checks if shuffle-sharded ring can be reused, and whether it receives |
| 4074 | // updates from "main" ring. |
no test coverage detected