signoz/pkg/query-service/app/opamp/otelconfig/config_parser_test.go
Srikanth Chekuri 210c5fd7f2
feat: opamp server application (#1787)
* feat: opamp server application

* chore: opamp

* chore: refactor server implementation

* chore: add Stop

* chore: merged opamp updates

* chore: removed all errorf

* chore: added a comment about zero version

* feat: added user context for created by

* chore: changed debugf to debug

* chore: removed lb from opamp + added config parser

* fix: added userid to ConfigNewVersion()

* chore: removed user id from contxt and added config parser

* fix: removed lock inside re-deploy

* chore: added config db fix

* fix: merged app/server.go from develop

* fix: restored extract jwt

* Update pkg/query-service/app/server.go

Co-authored-by: Nityananda Gohain <nityanandagohain@gmail.com>

* fix: dependency version fix and import added

---------

Co-authored-by: Pranay Prateek <pranay@signoz.io>
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
Co-authored-by: mindhash <mindhash@mindhashs-MacBook-Pro.local>
Co-authored-by: Nityananda Gohain <nityanandagohain@gmail.com>
2023-03-15 15:09:15 +05:30

59 lines
1.3 KiB
Go

package otelconfig
import (
"fmt"
"io/ioutil"
"testing"
"github.com/knadh/koanf/parsers/yaml"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/confmap"
)
func TestServiceConfig(t *testing.T) {
yamlFile, err := ioutil.ReadFile("./testdata/service.yaml")
if err != nil {
fmt.Printf("yamlFile.Get err #%v ", err)
t.Fail()
return
}
c, err := yaml.Parser().Unmarshal([]byte(yamlFile))
if err != nil {
fmt.Println("failed to parse config file as yaml", err)
t.Fail()
return
}
agentConf := confmap.NewFromStringMap(c)
configParser := NewConfigParser(agentConf)
expected := map[string]interface{}{
"extensions": []interface{}{"zpages"},
"pipelines": map[string]interface{}{
"traces": map[string]interface{}{
"receivers": []interface{}{"jaeger", "otlp"},
"processors": []interface{}{
"signozspanmetrics/prometheus", "batch",
},
"exporters": []interface{}{
"clickhousetraces",
},
},
"metrics": map[string]interface{}{
"receivers": []interface{}{
"otlp", "hostmetrics",
},
"processors": []interface{}{
"batch",
},
"exporters": []interface{}{
"clickhousemetricswrite",
},
},
},
}
require.Equal(t, expected, configParser.Service(), "expected same service config after parsing")
}