traceutil_test.go 1.1 KB

12345678910111213141516171819202122232425262728
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package traceutil
  4. import (
  5. "testing"
  6. "github.com/stretchr/testify/assert"
  7. "go.opentelemetry.io/collector/pdata/ptrace"
  8. )
  9. func TestSpanKindStr(t *testing.T) {
  10. assert.EqualValues(t, "SPAN_KIND_UNSPECIFIED", SpanKindStr(ptrace.SpanKindUnspecified))
  11. assert.EqualValues(t, "SPAN_KIND_INTERNAL", SpanKindStr(ptrace.SpanKindInternal))
  12. assert.EqualValues(t, "SPAN_KIND_SERVER", SpanKindStr(ptrace.SpanKindServer))
  13. assert.EqualValues(t, "SPAN_KIND_CLIENT", SpanKindStr(ptrace.SpanKindClient))
  14. assert.EqualValues(t, "SPAN_KIND_PRODUCER", SpanKindStr(ptrace.SpanKindProducer))
  15. assert.EqualValues(t, "SPAN_KIND_CONSUMER", SpanKindStr(ptrace.SpanKindConsumer))
  16. assert.EqualValues(t, "", SpanKindStr(ptrace.SpanKind(100)))
  17. }
  18. func TestStatusCodeStr(t *testing.T) {
  19. assert.EqualValues(t, "STATUS_CODE_UNSET", StatusCodeStr(ptrace.StatusCodeUnset))
  20. assert.EqualValues(t, "STATUS_CODE_OK", StatusCodeStr(ptrace.StatusCodeOk))
  21. assert.EqualValues(t, "STATUS_CODE_ERROR", StatusCodeStr(ptrace.StatusCodeError))
  22. assert.EqualValues(t, "", StatusCodeStr(ptrace.StatusCode(100)))
  23. }