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

Function TestStructuredEvent

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

Source from the content-addressed store, hash-verified

212}
213
214func TestStructuredEvent(t *testing.T) {
215 t.Parallel()
216 logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
217 // Use debug mode to avoid HTTP calls in tests
218 client := newClient(t.Context(), logger, true, true, "test-version")
219
220 event := CommandEvent{
221 Action: "test-command",
222 Success: true,
223 }
224
225 // Should not panic
226 client.Track(t.Context(), &event)
227}
228
229func TestGetTelemetryEnabled(t *testing.T) {
230 // When running under 'go test', GetTelemetryEnabled() always returns false

Callers

nothing calls this directly

Calls 4

newClientFunction · 0.85
ContextMethod · 0.80
NewMethod · 0.45
TrackMethod · 0.45

Tested by

no test coverage detected