mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-24 20:14:40 +02:00
33 lines
759 B
Go
33 lines
759 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package otel // import "go.opentelemetry.io/otel"
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"go.opentelemetry.io/otel/metric"
|
|
"go.opentelemetry.io/otel/metric/embedded"
|
|
"go.opentelemetry.io/otel/metric/noop"
|
|
)
|
|
|
|
type testMeterProvider struct{ embedded.MeterProvider }
|
|
|
|
var _ metric.MeterProvider = &testMeterProvider{}
|
|
|
|
func (*testMeterProvider) Meter(_ string, _ ...metric.MeterOption) metric.Meter {
|
|
return noop.NewMeterProvider().Meter("")
|
|
}
|
|
|
|
func TestMultipleGlobalMeterProvider(t *testing.T) {
|
|
p1 := testMeterProvider{}
|
|
p2 := noop.NewMeterProvider()
|
|
SetMeterProvider(&p1)
|
|
SetMeterProvider(p2)
|
|
|
|
got := GetMeterProvider()
|
|
assert.Equal(t, p2, got)
|
|
}
|