MCPcopy
hub / github.com/caddyserver/caddy / TestMetricsProvisionOTLPDisabled

Function TestMetricsProvisionOTLPDisabled

modules/caddyhttp/metrics_test.go:526–542  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

524}
525
526func TestMetricsProvisionOTLPDisabled(t *testing.T) {
527 ctx, _ := caddy.NewContext(caddy.Context{Context: context.Background()})
528
529 m := &Metrics{OTLP: false}
530
531 if err := m.provisionOTLP(ctx); err != nil {
532 t.Fatalf("provisionOTLP returned unexpected error: %v", err)
533 }
534 if m.meterProvider != nil {
535 t.Fatalf("meterProvider should remain nil when OTLP is disabled")
536 }
537
538 // shutdown must be safe on a never-provisioned Metrics.
539 if err := m.shutdown(context.Background()); err != nil {
540 t.Fatalf("shutdown returned unexpected error: %v", err)
541 }
542}
543
544func TestMetricsProvisionOTLPNoopExporter(t *testing.T) {
545 // OTEL_METRICS_EXPORTER=none makes autoexport return its built-in

Callers

nothing calls this directly

Calls 2

provisionOTLPMethod · 0.95
shutdownMethod · 0.95

Tested by

no test coverage detected