MCPcopy
hub / github.com/docker/docker-agent / TestWithClock_AppliedToRuntime

Function TestWithClock_AppliedToRuntime

pkg/runtime/clock_test.go:26–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24func (c *fakeClock) Advance(d time.Duration) { c.t = c.t.Add(d) }
25
26func TestWithClock_AppliedToRuntime(t *testing.T) {
27 t.Parallel()
28
29 prov := &mockProvider{id: "test/mock-model"}
30 root := agent.New("root", "test", agent.WithModel(prov))
31 tm := team.New(team.WithAgents(root))
32
33 fixed := time.Date(2024, 1, 2, 3, 4, 5, 0, time.UTC)
34 clock := newFakeClock(fixed)
35
36 rt, err := NewLocalRuntime(t.Context(), tm,
37 WithClock(clock.Now),
38 WithModelStore(mockModelStore{}),
39 )
40 require.NoError(t, err)
41
42 assert.Equal(t, fixed, rt.now(), "WithClock not wired into runtime")
43}
44
45func TestWithClock_NilLeavesDefault(t *testing.T) {
46 t.Parallel()

Callers

nothing calls this directly

Calls 10

NewFunction · 0.92
WithModelFunction · 0.92
NewFunction · 0.92
WithAgentsFunction · 0.92
newFakeClockFunction · 0.85
NewLocalRuntimeFunction · 0.85
WithModelStoreFunction · 0.85
ContextMethod · 0.80
nowMethod · 0.80
WithClockFunction · 0.70

Tested by

no test coverage detected