...

Source file src/github.com/opentracing/opentracing-go/globaltracer_test.go

Documentation: github.com/opentracing/opentracing-go

     1  package opentracing
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  )
     7  
     8  func TestIsGlobalTracerRegisteredDefaultIsFalse(t *testing.T) {
     9  	if IsGlobalTracerRegistered() {
    10  		t.Errorf("Should return false when no global tracer is registered.")
    11  	}
    12  }
    13  
    14  func TestAfterSettingGlobalTracerIsGlobalTracerRegisteredReturnsTrue(t *testing.T) {
    15  	SetGlobalTracer(NoopTracer{})
    16  
    17  	if !IsGlobalTracerRegistered() {
    18  		t.Errorf("Should return true after a tracer has been registered.")
    19  	}
    20  }
    21  
    22  func TestDefaultTracerIsNoopTracer(t *testing.T) {
    23  	if reflect.TypeOf(GlobalTracer()) != reflect.TypeOf(NoopTracer{}) {
    24  		t.Errorf("Should return false when no global tracer is registered.")
    25  	}
    26  }
    27  

View as plain text