mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
42 lines
809 B
Go
42 lines
809 B
Go
package tracing
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func Test_tracersProvider_getTracerProvider(t *testing.T) {
|
|
tp := tracerProvider{}
|
|
|
|
tp.getTracerProvider()
|
|
tp.getTracerProvider()
|
|
|
|
if tp.tracerProvider == nil {
|
|
t.Errorf("There should be tracer provider")
|
|
}
|
|
|
|
if tp.tracerProvidersCounter != 2 {
|
|
t.Errorf("Tracer providers counter should equal to 2")
|
|
}
|
|
}
|
|
|
|
func Test_tracersProvider_cleanupTracerProvider(t *testing.T) {
|
|
tp := tracerProvider{}
|
|
|
|
tp.getTracerProvider()
|
|
tp.getTracerProvider()
|
|
|
|
err := tp.cleanupTracerProvider(zap.NewNop())
|
|
if err != nil {
|
|
t.Errorf("There should be no error: %v", err)
|
|
}
|
|
|
|
if tp.tracerProvider == nil {
|
|
t.Errorf("There should be tracer provider")
|
|
}
|
|
|
|
if tp.tracerProvidersCounter != 1 {
|
|
t.Errorf("Tracer providers counter should equal to 1")
|
|
}
|
|
}
|