MCPcopy Index your code
hub / github.com/docker/docker-agent / TestCooldownManager_SetAndGet

Function TestCooldownManager_SetAndGet

pkg/runtime/cooldown_manager_test.go:19–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17}
18
19func TestCooldownManager_SetAndGet(t *testing.T) {
20 t.Parallel()
21
22 clock := newFakeClock(time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC))
23 m := newCooldownManager(clock.Now)
24
25 m.Set("agent-A", 2, time.Minute)
26
27 state := m.Get("agent-A")
28 require.NotNil(t, state)
29 assert.Equal(t, 2, state.fallbackIndex)
30 assert.True(t, state.until.After(clock.Now()), "until must be in the future")
31}
32
33func TestCooldownManager_GetEvictsExpired(t *testing.T) {
34 t.Parallel()

Callers

nothing calls this directly

Calls 5

newFakeClockFunction · 0.85
newCooldownManagerFunction · 0.85
NowMethod · 0.80
GetMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected