12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // Copyright The OpenTelemetry Authors
- // SPDX-License-Identifier: Apache-2.0
- package mongodbreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbreceiver"
- import (
- "context"
- "testing"
- "time"
- "github.com/stretchr/testify/require"
- "go.opentelemetry.io/collector/component"
- "go.opentelemetry.io/collector/consumer/consumertest"
- "go.opentelemetry.io/collector/receiver/receivertest"
- "go.opentelemetry.io/collector/receiver/scraperhelper"
- )
- func TestType(t *testing.T) {
- factory := NewFactory()
- ft := factory.Type()
- require.EqualValues(t, "mongodb", ft)
- }
- func TestValidConfig(t *testing.T) {
- factory := NewFactory()
- require.NoError(t, component.ValidateConfig(factory.CreateDefaultConfig()))
- }
- func TestCreateMetricsReceiver(t *testing.T) {
- factory := NewFactory()
- _, err := factory.CreateMetricsReceiver(
- context.Background(),
- receivertest.NewNopCreateSettings(),
- &Config{
- ScraperControllerSettings: scraperhelper.ScraperControllerSettings{
- CollectionInterval: 10 * time.Second,
- InitialDelay: time.Second,
- },
- },
- consumertest.NewNop(),
- )
- require.NoError(t, err)
- }
|