factory_test.go 589 B

12345678910111213141516171819202122232425262728
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package simpleprometheusreceiver
  4. import (
  5. "context"
  6. "testing"
  7. "github.com/stretchr/testify/require"
  8. "go.opentelemetry.io/collector/consumer/consumertest"
  9. "go.opentelemetry.io/collector/receiver/receivertest"
  10. )
  11. func TestFactory(t *testing.T) {
  12. f := NewFactory()
  13. cfg := f.CreateDefaultConfig()
  14. require.NotNil(t, cfg)
  15. r, err := f.CreateMetricsReceiver(
  16. context.Background(),
  17. receivertest.NewNopCreateSettings(),
  18. cfg,
  19. consumertest.NewNop(),
  20. )
  21. require.NoError(t, err)
  22. require.NotNil(t, r)
  23. }