factory_test.go 625 B

12345678910111213141516171819202122232425262728
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package memoryscraper
  4. import (
  5. "context"
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. "go.opentelemetry.io/collector/receiver/receivertest"
  9. )
  10. func TestCreateDefaultConfig(t *testing.T) {
  11. factory := &Factory{}
  12. cfg := factory.CreateDefaultConfig()
  13. assert.IsType(t, &Config{}, cfg)
  14. }
  15. func TestCreateMetricsScraper(t *testing.T) {
  16. factory := &Factory{}
  17. cfg := &Config{}
  18. scraper, err := factory.CreateMetricsScraper(context.Background(), receivertest.NewNopCreateSettings(), cfg)
  19. assert.NoError(t, err)
  20. assert.NotNil(t, scraper)
  21. }