You've already forked opentelemetry-go
							
							
				mirror of
				https://github.com/open-telemetry/opentelemetry-go.git
				synced 2025-10-31 00:07:40 +02:00 
			
		
		
		
	Part of #7006 - Generate the base `x` package content - Add a README.md describing the observability feature - Add the observability feature
		
			
				
	
	
		
			22 lines
		
	
	
		
			636 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			636 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright The OpenTelemetry Authors
 | |
| // SPDX-License-Identifier: Apache-2.0
 | |
| 
 | |
| package x
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/stretchr/testify/require"
 | |
| )
 | |
| 
 | |
| func TestObservability(t *testing.T) {
 | |
| 	const key = "OTEL_GO_X_OBSERVABILITY"
 | |
| 	require.Contains(t, Observability.Keys(), key)
 | |
| 
 | |
| 	t.Run("100", run(setenv(key, "100"), assertDisabled(Observability)))
 | |
| 	t.Run("true", run(setenv(key, "true"), assertEnabled(Observability, "true")))
 | |
| 	t.Run("True", run(setenv(key, "True"), assertEnabled(Observability, "True")))
 | |
| 	t.Run("false", run(setenv(key, "false"), assertDisabled(Observability)))
 | |
| 	t.Run("empty", run(assertDisabled(Observability)))
 | |
| }
 |