File: globaltracer_test.go

package info (click to toggle)
golang-github-opentracing-opentracing-go 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, bookworm-proposed-updates, forky, sid, trixie
  • size: 268 kB
  • sloc: makefile: 18
file content (26 lines) | stat: -rw-r--r-- 651 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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.")
	}
}