Debian Codegraph @

sdk/resource/host_id_export_test.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package resource_test
5
6 import (
7 "github.com/stretchr/testify/assert"
8
9 "go.opentelemetry.io/otel/sdk/resource"
10 )
11
12 func mockHostIDProvider() {
13 resource.SetHostIDProvider(
14 func() (string, error) { return "f2c668b579780554f70f72a063dc0864", nil },
15 )
16 }
17
18 func mockHostIDProviderWithError() {
19 resource.SetHostIDProvider(
20 func() (string, error) { return "", assert.AnError },
21 )
22 }
23
24 func restoreHostIDProvider() {
25 resource.SetDefaultHostIDProvider()
26 }