factory_test.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package zipkinreceiver
  4. import (
  5. "context"
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. "go.opentelemetry.io/collector/component/componenttest"
  9. "go.opentelemetry.io/collector/consumer/consumertest"
  10. "go.opentelemetry.io/collector/receiver/receivertest"
  11. )
  12. func TestCreateDefaultConfig(t *testing.T) {
  13. cfg := createDefaultConfig()
  14. assert.NotNil(t, cfg, "failed to create default config")
  15. assert.NoError(t, componenttest.CheckConfigStruct(cfg))
  16. }
  17. func TestCreateReceiver(t *testing.T) {
  18. cfg := createDefaultConfig()
  19. tReceiver, err := createTracesReceiver(
  20. context.Background(),
  21. receivertest.NewNopCreateSettings(),
  22. cfg,
  23. consumertest.NewNop())
  24. assert.NoError(t, err, "receiver creation failed")
  25. assert.NotNil(t, tReceiver, "receiver creation failed")
  26. tReceiver, err = createTracesReceiver(
  27. context.Background(),
  28. receivertest.NewNopCreateSettings(),
  29. cfg,
  30. consumertest.NewNop())
  31. assert.NoError(t, err, "receiver creation failed")
  32. assert.NotNil(t, tReceiver, "receiver creation failed")
  33. }