Debian Codegraph @

internal/global/util_test.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package global
5
6 import (
7 "sync"
8 "testing"
9 )
10
11 // ResetForTest configures the test to restores the initial global state during
12 // its Cleanup step.
13 func ResetForTest(t testing.TB) {
14 t.Cleanup(func() {
15 globalTracer = defaultTracerValue()
16 globalPropagators = defaultPropagatorsValue()
17 globalMeterProvider = defaultMeterProvider()
18 delegateTraceOnce = sync.Once{}
19 delegateTextMapPropagatorOnce = sync.Once{}
20 delegateMeterOnce = sync.Once{}
21 })
22 }