Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyll committed Feb 9, 2018
1 parent 63c0fd9 commit 5a94348
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions plugin/grpc/grpctrace/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ func (t *testExporter) ExportSpan(s *trace.SpanData) {
}

func TestSpanCreation(t *testing.T) {
client, _, cleanup, err := newTestClientAndServer()
if err != nil {
t.Fatalf("initializing client and server: %v", err)
}
defer cleanup()

trace.SetDefaultSampler(trace.AlwaysSample())
te := testExporter{make(chan *trace.SpanData)}
trace.RegisterExporter(&te)
Expand All @@ -109,6 +103,10 @@ func TestSpanCreation(t *testing.T) {
{false, false},
{false, true},
} {
client, _, cleanup, err := newTestClientAndServer()
if err != nil {
t.Fatalf("initializing client and server: %v", err)
}
var methodName string
if test.streaming {
methodName = ".testdata.Foo.Multiple"
Expand All @@ -133,7 +131,7 @@ func TestSpanCreation(t *testing.T) {
if err != nil {
t.Fatalf("%#v: couldn't send streaming request: %v", test, err)
}
_, err := stream.Recv()
_, err = stream.Recv()
if err != nil {
t.Errorf("%#v: couldn't receive streaming response: %v", test, err)
}
Expand All @@ -158,6 +156,8 @@ func TestSpanCreation(t *testing.T) {
}
}

cleanup()

// get the client- and server-side spans from the exporter.
s2 := <-te.ch
s1 := <-te.ch
Expand Down

0 comments on commit 5a94348

Please sign in to comment.