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

Function TestNewClient

pkg/telemetry/telemetry_test.go:91–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

89}
90
91func TestNewClient(t *testing.T) {
92 t.Parallel()
93 logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
94
95 // Note: debug mode does NOT disable HTTP calls - it only adds extra logging
96 client := newClient(t.Context(), logger, false, false, "test-version")
97
98 // This should not panic
99 commandEvent := &CommandEvent{
100 Action: "test-command",
101 Success: true,
102 Error: "",
103 }
104 client.Track(t.Context(), commandEvent)
105 client.RecordToolCall(t.Context(), "test-tool", "session-id", "agent-name", time.Millisecond, nil)
106 client.RecordTokenUsage(t.Context(), "test-model", 100, 50, 0.5)
107}
108
109func TestSessionTracking(t *testing.T) {
110 t.Parallel()

Callers

nothing calls this directly

Calls 6

newClientFunction · 0.85
ContextMethod · 0.80
RecordToolCallMethod · 0.65
RecordTokenUsageMethod · 0.65
NewMethod · 0.45
TrackMethod · 0.45

Tested by

no test coverage detected