factory_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package azureeventhubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver"
  4. import (
  5. "context"
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. "go.opentelemetry.io/collector/component"
  9. "go.opentelemetry.io/collector/consumer/consumertest"
  10. "go.opentelemetry.io/collector/receiver/receivertest"
  11. )
  12. func Test_NewFactory(t *testing.T) {
  13. f := NewFactory()
  14. assert.Equal(t, component.Type("azureeventhub"), f.Type())
  15. }
  16. func Test_NewLogsReceiver(t *testing.T) {
  17. f := NewFactory()
  18. receiver, err := f.CreateLogsReceiver(context.Background(), receivertest.NewNopCreateSettings(), f.CreateDefaultConfig(), consumertest.NewNop())
  19. assert.NoError(t, err)
  20. assert.NotNil(t, receiver)
  21. }
  22. func Test_NewMetricsReceiver(t *testing.T) {
  23. f := NewFactory()
  24. receiver, err := f.CreateMetricsReceiver(context.Background(), receivertest.NewNopCreateSettings(), f.CreateDefaultConfig(), consumertest.NewNop())
  25. assert.NoError(t, err)
  26. assert.NotNil(t, receiver)
  27. }