mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-03 02:20:04 +00:00
- add metadata.yaml for all relevant components and use metadata - fix the go routine leaks in component code and tests - add TODO for handling errors wherever they are unchecked or not handled so the behaviour doesn't change - address lint for the most part (so we can enable it soon) except the metricexporter that is due to be deleted and semconv which I don't want to touch right now - other changes required for bump breaking changes to pay attention to - telemetry config, address and level removed and readers should be used - change in attributes for telemetry - metrics at detailed level - failures in embedded config (addressed) --------- Co-authored-by: Nityananda Gohain <[email protected]>
56 lines
1.2 KiB
Go
56 lines
1.2 KiB
Go
package clickhousesystemtablesreceiver
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"go.opentelemetry.io/collector/confmap/confmaptest"
|
|
"go.opentelemetry.io/collector/confmap/xconfmap"
|
|
)
|
|
|
|
func TestLoadConfig(t *testing.T) {
|
|
require := require.New(t)
|
|
|
|
tests := []struct {
|
|
name string
|
|
testConfFileName string
|
|
expectedErr bool
|
|
}{
|
|
{
|
|
name: "valid",
|
|
testConfFileName: "config.yaml",
|
|
expectedErr: false,
|
|
}, {
|
|
name: "no dsn specified",
|
|
testConfFileName: "badConfigNoDsn.yaml",
|
|
expectedErr: true,
|
|
}, {
|
|
name: "no min scrape delay specified",
|
|
testConfFileName: "badConfigNoScrapeDelay.yaml",
|
|
expectedErr: true,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
factory := NewFactory()
|
|
cfg := factory.CreateDefaultConfig()
|
|
|
|
cm, err := confmaptest.LoadConf(filepath.Join("testdata", tt.testConfFileName))
|
|
require.Nil(err)
|
|
|
|
sub, err := cm.Sub("clickhousesystemtablesreceiver")
|
|
require.Nil(err)
|
|
|
|
require.NoError(sub.Unmarshal(cfg))
|
|
|
|
if tt.expectedErr {
|
|
require.Error(xconfmap.Validate(cfg))
|
|
} else {
|
|
require.NoError(xconfmap.Validate(cfg))
|
|
|
|
}
|
|
}
|
|
|
|
}
|