Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Add disabled unit test showing race condition
Browse files Browse the repository at this point in the history
Reported in #526.

Signed-off-by: Yuri Shkuro <ys@uber.com>
  • Loading branch information
Yuri Shkuro committed Aug 16, 2020
1 parent b58b8ea commit 7b8d143
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,40 @@ func TestSpan_References(t *testing.T) {
})
}
}

func TestSpanContextRaces(t *testing.T) {
t.Skip("Skipped: test will panic with -race, see https://github.com/jaegertracing/jaeger-client-go/issues/526")
tracer, closer := NewTracer("test", NewConstSampler(true), NewNullReporter())
defer closer.Close()

span := tracer.StartSpan("test-span").(*Span)
end := make(chan struct{})

accessor := func(f func()) {
for {
select {
case <-end:
return
default:
f()
}
}
}
go accessor(func() {
span.Context()
})
go accessor(func() {
span.SetTag("k", "v")
})
go accessor(func() {
span.LogKV("k", "v")
})
go accessor(func() {
span.SetBaggageItem("k", "v")
})
go accessor(func() {
span.BaggageItem("k")
})
time.Sleep(100 * time.Millisecond)
close(end)
}

0 comments on commit 7b8d143

Please sign in to comment.