12345678910111213141516171819202122232425262728293031 |
- // Copyright The OpenTelemetry Authors
- // SPDX-License-Identifier: Apache-2.0
- package collectdreceiver
- import (
- "context"
- "testing"
- "github.com/stretchr/testify/assert"
- "go.opentelemetry.io/collector/component/componenttest"
- "go.opentelemetry.io/collector/consumer/consumertest"
- "go.opentelemetry.io/collector/receiver/receivertest"
- )
- func TestCreateDefaultConfig(t *testing.T) {
- factory := NewFactory()
- cfg := factory.CreateDefaultConfig()
- assert.NotNil(t, cfg, "failed to create default config")
- assert.NoError(t, componenttest.CheckConfigStruct(cfg))
- }
- func TestCreateReceiver(t *testing.T) {
- factory := NewFactory()
- cfg := factory.CreateDefaultConfig()
- params := receivertest.NewNopCreateSettings()
- tReceiver, err := factory.CreateMetricsReceiver(context.Background(), params, cfg, consumertest.NewNop())
- assert.NoError(t, err)
- assert.NotNil(t, tReceiver, "receiver creation failed")
- }
|