| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
package debugexporter |
| 5 |
|
| 6 |
import ( |
| 7 |
"context" |
| 8 |
"testing" |
| 9 |
|
| 10 |
"github.com/stretchr/testify/assert" |
| 11 |
"github.com/stretchr/testify/require" |
| 12 |
|
| 13 |
"go.opentelemetry.io/collector/component/componenttest" |
| 14 |
"go.opentelemetry.io/collector/exporter/exportertest" |
| 15 |
"go.opentelemetry.io/collector/exporter/xexporter" |
| 16 |
) |
| 17 |
|
| 18 |
func TestCreateDefaultConfig(t *testing.T) { |
| 19 |
factory := NewFactory() |
| 20 |
cfg := factory.CreateDefaultConfig() |
| 21 |
assert.NotNil(t, cfg, "failed to create default config") |
| 22 |
assert.NoError(t, componenttest.CheckConfigStruct(cfg)) |
| 23 |
} |
| 24 |
|
| 25 |
func TestCreateMetrics(t *testing.T) { |
| 26 |
factory := NewFactory() |
| 27 |
cfg := factory.CreateDefaultConfig() |
| 28 |
|
| 29 |
me, err := factory.CreateMetrics(context.Background(), exportertest.NewNopSettings(factory.Type()), cfg) |
| 30 |
require.NoError(t, err) |
| 31 |
assert.NotNil(t, me) |
| 32 |
} |
| 33 |
|
| 34 |
func TestCreateTraces(t *testing.T) { |
| 35 |
factory := NewFactory() |
| 36 |
cfg := factory.CreateDefaultConfig() |
| 37 |
|
| 38 |
te, err := factory.CreateTraces(context.Background(), exportertest.NewNopSettings(factory.Type()), cfg) |
| 39 |
require.NoError(t, err) |
| 40 |
assert.NotNil(t, te) |
| 41 |
} |
| 42 |
|
| 43 |
func TestCreateLogs(t *testing.T) { |
| 44 |
factory := NewFactory() |
| 45 |
cfg := factory.CreateDefaultConfig() |
| 46 |
|
| 47 |
te, err := factory.CreateLogs(context.Background(), exportertest.NewNopSettings(factory.Type()), cfg) |
| 48 |
require.NoError(t, err) |
| 49 |
assert.NotNil(t, te) |
| 50 |
} |
| 51 |
|
| 52 |
func TestCreateFactoryProfiles(t *testing.T) { |
| 53 |
factory := NewFactory() |
| 54 |
cfg := factory.CreateDefaultConfig() |
| 55 |
|
| 56 |
te, err := factory.(xexporter.Factory).CreateProfiles(context.Background(), exportertest.NewNopSettings(factory.Type()), cfg) |
| 57 |
require.NoError(t, err) |
| 58 |
assert.NotNil(t, te) |
| 59 |
} |