Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix jaeger exporter test panic #1973

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- BatchSpanProcessor now drops span batches that failed to be exported. (#1860)
- Use `http://localhost:14268/api/traces` as default Jaeger collector endpoint instead of `http://localhost:14250`. (#1898)
- Allow trailing and leading whitespace in the parsing of a `tracestate` header. (#1931)
- Add logic to determine if the channel is closed to fix Jaeger exporter test panic with close closed channel. (#1870, #1973)

### Security

Expand Down
13 changes: 12 additions & 1 deletion exporters/trace/jaeger/reconnecting_udp_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ func assertConnWritable(t *testing.T, conn udpConn, serverConn net.PacketConn) {
func waitForCallWithTimeout(call *mock.Call) bool {
called := make(chan struct{})
call.Run(func(args mock.Arguments) {
close(called)
if !isChannelClosed(called) {
close(called)
}
})

var wasCalled bool
Expand All @@ -114,6 +116,15 @@ func waitForCallWithTimeout(call *mock.Call) bool {
return wasCalled
}

func isChannelClosed(ch <-chan struct{}) bool {
select {
case <-ch:
return true
default:
}
return false
}

func waitForConnCondition(conn *reconnectingUDPConn, condition func(conn *reconnectingUDPConn) bool) bool {
var conditionVal bool
for i := 0; i < 10; i++ {
Expand Down