MCPcopy Create free account
hub / github.com/erpc/erpc / TestTryFastFailOpen_DownWithinWindow

Function TestTryFastFailOpen_DownWithinWindow

auth/strategy_database_test.go:353–367  ·  view source on GitHub ↗

TestTryFastFailOpen_DownWithinWindow verifies that during the cooldown window (downSince fresh), ALL callers fast-path — no probes are elected until probeInterval elapses since the down transition.

(t *testing.T)

Source from the content-addressed store, hash-verified

351// window (downSince fresh), ALL callers fast-path — no probes are elected
352// until probeInterval elapses since the down transition.
353func TestTryFastFailOpen_DownWithinWindow(t *testing.T) {
354 t.Parallel()
355 fc := &fakeConnector{id: "test"}
356 s := newTestStrategyWith(t, fc, true)
357
358 s.markConnectorDown()
359 // downSince is set by markConnectorDown to time.Now(), so we're well
360 // inside the probe interval.
361
362 for i := 0; i < 50; i++ {
363 u := s.tryFastFailOpen()
364 require.NotNil(t, u, "every caller within the probe window must fast-path; iter=%d", i)
365 assert.Equal(t, "emergency-failopen", u.Id)
366 }
367}
368
369// TestGetWithRetries_SkipsRetryOnNotReady verifies the retry loop aborts
370// immediately on data.ErrConnectorNotReady. Retrying during a known

Callers

nothing calls this directly

Calls 3

newTestStrategyWithFunction · 0.85
markConnectorDownMethod · 0.80
tryFastFailOpenMethod · 0.80

Tested by

no test coverage detected