marshaler_test.go 647 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package awss3exporter
  4. import (
  5. "testing"
  6. "github.com/stretchr/testify/assert"
  7. "github.com/stretchr/testify/require"
  8. "go.uber.org/zap"
  9. )
  10. func TestMarshaler(t *testing.T) {
  11. {
  12. m, err := newMarshaler("otlp_json", zap.NewNop())
  13. assert.NoError(t, err)
  14. require.NotNil(t, m)
  15. assert.Equal(t, m.format(), "json")
  16. }
  17. {
  18. m, err := newMarshaler("sumo_ic", zap.NewNop())
  19. assert.NoError(t, err)
  20. require.NotNil(t, m)
  21. assert.Equal(t, m.format(), "json.gz")
  22. }
  23. {
  24. m, err := newMarshaler("unknown", zap.NewNop())
  25. assert.Error(t, err)
  26. require.Nil(t, m)
  27. }
  28. }