factory_test.go 783 B

1234567891011121314151617181920212223242526272829
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package alertmanagerexporter
  4. import (
  5. "context"
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. "go.opentelemetry.io/collector/component/componenttest"
  9. "go.opentelemetry.io/collector/exporter/exportertest"
  10. )
  11. func TestCreateDefaultConfig(t *testing.T) {
  12. factory := NewFactory()
  13. cfg := factory.CreateDefaultConfig()
  14. assert.NotNil(t, cfg, "failed to create default config")
  15. assert.NoError(t, componenttest.CheckConfigStruct(cfg))
  16. }
  17. func TestCreateTracesExporter(t *testing.T) {
  18. factory := NewFactory()
  19. cfg := factory.CreateDefaultConfig()
  20. te, err := factory.CreateTracesExporter(context.Background(), exportertest.NewNopCreateSettings(), cfg)
  21. assert.NoError(t, err)
  22. assert.NotNil(t, te)
  23. }