factory_test.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package syslogexporter
  4. import (
  5. "testing"
  6. "time"
  7. "github.com/cenkalti/backoff/v4"
  8. "github.com/stretchr/testify/assert"
  9. "go.opentelemetry.io/collector/component"
  10. "go.opentelemetry.io/collector/exporter/exporterhelper"
  11. )
  12. func TestType(t *testing.T) {
  13. factory := NewFactory()
  14. pType := factory.Type()
  15. assert.Equal(t, pType, component.Type("syslog"))
  16. }
  17. func TestCreateDefaultConfig(t *testing.T) {
  18. cfg := createDefaultConfig()
  19. assert.Equal(t, cfg, &Config{
  20. Port: 514,
  21. Network: "tcp",
  22. Protocol: "rfc5424",
  23. QueueSettings: exporterhelper.QueueSettings{
  24. Enabled: false,
  25. NumConsumers: 10,
  26. QueueSize: 1000,
  27. },
  28. RetrySettings: exporterhelper.RetrySettings{
  29. Enabled: true,
  30. InitialInterval: 5 * time.Second,
  31. RandomizationFactor: backoff.DefaultRandomizationFactor,
  32. Multiplier: backoff.DefaultMultiplier,
  33. MaxInterval: 30 * time.Second,
  34. MaxElapsedTime: 5 * time.Minute,
  35. },
  36. TimeoutSettings: exporterhelper.TimeoutSettings{
  37. Timeout: 5 * time.Second,
  38. },
  39. })
  40. }