7ce7c9df4d
Feature/ecr * nosave * repo * awscli * unzip * ignore * moreram * 14k * ref * deployment * 12k * uselocal * go * dockercomd * reorder * iamgename * installs * tart * cli * clideps * y * dockerce * nodock * multi * rmecr * dev
34 lines
658 B
Go
34 lines
658 B
Go
package observability_test
|
|
|
|
import (
|
|
"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 := t.Context()
|
|
|
|
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)
|
|
}
|
|
}()
|
|
}
|