Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
yurishkuro committed Jan 5, 2025
1 parent 4a370fb commit 85d9c20
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
66 changes: 66 additions & 0 deletions cmd/collector/app/processor/processor_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright (c) 2025 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package processor

import (
"testing"

"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/pdata/ptrace"

"github.com/jaegertracing/jaeger/model"
)

func TestDetails(t *testing.T) {
d := Details{
SpanFormat: JaegerSpanFormat,
InboundTransport: InboundTransport("grpc"),
Tenant: "tenant",
}
assert.Equal(t, JaegerSpanFormat, d.GetSpanFormat())
assert.Equal(t, InboundTransport("grpc"), d.GetInboundTransport())
assert.Equal(t, "tenant", d.GetTenant())
}

func TestSpansV1(t *testing.T) {
s := SpansV1{
Spans: []*model.Span{{}},
Details: Details{
SpanFormat: JaegerSpanFormat,
InboundTransport: InboundTransport("grpc"),
Tenant: "tenant",
},
}
var spans []*model.Span
s.GetSpans(func(s []*model.Span) {
spans = s
}, func(_ ptrace.Traces) {
panic("not implemented")
})
assert.Equal(t, []*model.Span{{}}, spans)
assert.Equal(t, JaegerSpanFormat, s.GetSpanFormat())
assert.Equal(t, InboundTransport("grpc"), s.GetInboundTransport())
assert.Equal(t, "tenant", s.GetTenant())
}

func TestSpansV2(t *testing.T) {
s := SpansV2{
Traces: ptrace.NewTraces(),
Details: Details{
SpanFormat: JaegerSpanFormat,
InboundTransport: InboundTransport("grpc"),
Tenant: "tenant",
},
}
var traces ptrace.Traces
s.GetSpans(func(_ []*model.Span) {
panic("not implemented")
}, func(t ptrace.Traces) {
traces = t
})
assert.Equal(t, ptrace.NewTraces(), traces)
assert.Equal(t, JaegerSpanFormat, s.GetSpanFormat())
assert.Equal(t, InboundTransport("grpc"), s.GetInboundTransport())
assert.Equal(t, "tenant", s.GetTenant())
}

0 comments on commit 85d9c20

Please sign in to comment.