Skip to content

Commit

Permalink
Add workaround for data race in TestApplication_StartUnified
Browse files Browse the repository at this point in the history
Added a Sleep to work around a data race bug in Jaeger
(jaegertracing/jaeger#1625) caused
by stopping immediately after starting.

Without this Sleep we were observing this bug on our side:
open-telemetry#43
The Sleep ensures that Jaeger Start() is fully completed before
we call Jaeger Stop().

TODO: Jaeger bug is already fixed, remove this once we update Jaeger
to latest version.

Testing done: make test
  • Loading branch information
Tigran Najaryan committed Jul 3, 2019
1 parent 886e62f commit c80092f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/occollector/app/collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"net"
"net/http"
"testing"
"time"

"github.com/open-telemetry/opentelemetry-service/internal/testutils"
"github.com/open-telemetry/opentelemetry-service/internal/zpagesserver"
Expand Down Expand Up @@ -94,6 +95,19 @@ func TestApplication_StartUnified(t *testing.T) {
if !isAppAvailable(t, "http://"+addresses[0]) {
t.Fatalf("App didn't reach ready state")
}

// We have to wait here work around a data race bug in Jaeger
// (https://github.com/jaegertracing/jaeger/pull/1625) caused
// by stopping immediately after starting.
//
// Without this Sleep we were observing this bug on our side:
// https://github.com/open-telemetry/opentelemetry-service/issues/43
// The Sleep ensures that Jaeger Start() is fully completed before
// we call Jaeger Stop().
// TODO: Jaeger bug is already fixed, remove this once we update Jaeger
// to latest version.
time.Sleep(1 * time.Second)

close(App.stopTestChan)
<-appDone
}
Expand Down

0 comments on commit c80092f

Please sign in to comment.