mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-04 23:50:38 +08:00

### Summary A config package based on https://github.com/open-telemetry/opentelemetry-collector/blob/main/confmap/confmap.go for signoz. #### Related Issues / PR's This is a part of https://github.com/SigNoz/signoz/pull/5710
35 lines
626 B
Go
35 lines
626 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"go.opentelemetry.io/collector/confmap"
|
|
"go.signoz.io/signoz/pkg/instrumentation"
|
|
)
|
|
|
|
func TestUnmarshal(t *testing.T) {
|
|
input := confmap.NewFromStringMap(
|
|
map[string]any{
|
|
"instrumentation": map[string]any{
|
|
"logs": map[string]bool{
|
|
"enabled": true,
|
|
},
|
|
},
|
|
},
|
|
)
|
|
expected := &Config{
|
|
Instrumentation: instrumentation.Config{
|
|
Logs: instrumentation.LogsConfig{
|
|
Enabled: true,
|
|
},
|
|
},
|
|
}
|
|
cfg, err := unmarshal(input)
|
|
require.NoError(t, err)
|
|
|
|
assert.Equal(t, expected, cfg)
|
|
|
|
}
|