factory_test.go 751 B

1234567891011121314151617181920212223
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package datadogreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver"
  4. import (
  5. "context"
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. "go.opentelemetry.io/collector/consumer/consumertest"
  9. "go.opentelemetry.io/collector/receiver/receivertest"
  10. )
  11. func TestCreateReceiver(t *testing.T) {
  12. factory := NewFactory()
  13. cfg := factory.CreateDefaultConfig()
  14. cfg.(*Config).Endpoint = "http://localhost:0"
  15. tReceiver, err := factory.CreateTracesReceiver(context.Background(), receivertest.NewNopCreateSettings(), cfg, consumertest.NewNop())
  16. assert.NoError(t, err)
  17. assert.NotNil(t, tReceiver, "receiver creation failed")
  18. }