Skip to content

Commit

Permalink
Add workaround for data race in TestApplication_StartUnified (#96)
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:
#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
tigrannajaryan authored and songy23 committed Jul 3, 2019
1 parent 31d6389 commit 69732f8
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 69732f8

Please sign in to comment.