mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
44 lines
810 B
Go
44 lines
810 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")
|
||
|
}
|
||
|
}
|