MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestWaitInstanceState_Timeout

Function TestWaitInstanceState_Timeout

pkg/ring/util_test.go:276–294  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

274}
275
276func TestWaitInstanceState_Timeout(t *testing.T) {
277 t.Parallel()
278
279 const (
280 instanceID = "test"
281 timeoutDuration = time.Second
282 )
283
284 ctx, cancel := context.WithTimeout(context.Background(), timeoutDuration)
285 defer cancel()
286
287 ring := &RingMock{}
288 ring.On("GetInstanceState", mock.Anything, mock.Anything).Return(ACTIVE, nil)
289
290 err := WaitInstanceState(ctx, ring, instanceID, PENDING)
291
292 assert.Equal(t, context.DeadlineExceeded, err)
293 ring.AssertCalled(t, "GetInstanceState", instanceID)
294}
295
296func TestWaitInstanceState_TimeoutOnError(t *testing.T) {
297 t.Parallel()

Callers

nothing calls this directly

Calls 2

WaitInstanceStateFunction · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected