Debian Codegraph @

sdk/log/internal/x/features_test.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package x
5
6 import (
7 "testing"
8
9 "github.com/stretchr/testify/require"
10 )
11
12 func TestObservability(t *testing.T) {
13 const key = "OTEL_GO_X_OBSERVABILITY"
14 require.Contains(t, Observability.Keys(), key)
15
16 const altKey = "OTEL_GO_X_SELF_OBSERVABILITY"
17 require.Contains(t, Observability.Keys(), altKey)
18
19 t.Run("100", run(setenv(key, "100"), assertDisabled(Observability)))
20 t.Run("true", run(setenv(key, "true"), assertEnabled(Observability, "true")))
21 t.Run("True", run(setenv(key, "True"), assertEnabled(Observability, "True")))
22 t.Run("false", run(setenv(key, "false"), assertDisabled(Observability)))
23 t.Run("empty", run(assertDisabled(Observability)))
24 }