Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
add unit tests for GlobalTracer
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGoldsmith committed Nov 29, 2018
1 parent 8df1fd1 commit b12a8d2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions globaltracer_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package opentracing

import (
"reflect"
"testing"
)

func TestIsGlobalTracerRegisteredDefaultIsFalse(t *testing.T) {
if IsGlobalTracerRegistered() {
t.Errorf("Should return false when no global tracer is registered.")
}
}

func TestAfterSettingGlobalTracerIsGlobalTracerRegisteredReturnsTrue(t *testing.T) {
SetGlobalTracer(NoopTracer{})

if !IsGlobalTracerRegistered() {
t.Errorf("Should return true after a tracer has been registered.")
}
}

func TestDefaultTracerIsNoopTracer(t *testing.T) {
if reflect.TypeOf(GlobalTracer()) != reflect.TypeOf(NoopTracer{}) {
t.Errorf("Should return false when no global tracer is registered.")
}
}

0 comments on commit b12a8d2

Please sign in to comment.