bbd86fb4ea
Collector Build Version * lint * fixtests
35 lines
678 B
Go
35 lines
678 B
Go
package observability_test
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"queryorchestration/internal/serviceconfig/observability"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsOtelEnabled(t *testing.T) {
|
|
c := observability.ObsConfig{}
|
|
assert.False(t, c.IsOtelEnabled())
|
|
c.EnableOtel = true
|
|
assert.True(t, c.IsOtelEnabled())
|
|
}
|
|
|
|
func TestSetOtel(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
cfg := &observability.ObsConfig{
|
|
EnableOtel: true,
|
|
}
|
|
clean := cfg.SetOtel(ctx)
|
|
assert.NotNil(t, clean)
|
|
defer func() {
|
|
if err := clean(); err != nil {
|
|
// Log cleanup error but don't panic since we're shutting down
|
|
fmt.Printf("Error during clean: %v", err)
|
|
}
|
|
}()
|
|
}
|