1234567891011121314151617181920212223242526272829303132333435363738 |
- // Copyright The OpenTelemetry Authors
- // SPDX-License-Identifier: Apache-2.0
- package lokireceiver
- import (
- "context"
- "testing"
- "github.com/stretchr/testify/assert"
- "go.opentelemetry.io/collector/component/componenttest"
- "go.opentelemetry.io/collector/config/configgrpc"
- "go.opentelemetry.io/collector/config/confignet"
- "go.opentelemetry.io/collector/consumer/consumertest"
- "go.opentelemetry.io/collector/receiver/receivertest"
- )
- func TestCreateDefaultConfig(t *testing.T) {
- factory := NewFactory()
- cfg := factory.CreateDefaultConfig()
- assert.NotNil(t, cfg, "failed to create default config")
- assert.NoError(t, componenttest.CheckConfigStruct(cfg))
- }
- func TestCreateReceiver(t *testing.T) {
- factory := NewFactory()
- cfg := factory.CreateDefaultConfig()
- cfg.(*Config).Protocols.GRPC = &configgrpc.GRPCServerSettings{
- NetAddr: confignet.NetAddr{
- Endpoint: defaultGRPCBindEndpoint,
- Transport: "tcp",
- },
- }
- set := receivertest.NewNopCreateSettings()
- receiver, err := factory.CreateLogsReceiver(context.Background(), set, cfg, consumertest.NewNop())
- assert.NoError(t, err, "receiver creation failed")
- assert.NotNil(t, receiver, "receiver creation failed")
- }
|