Skip to content

Commit f6aeb0d

Browse files
authored
otelgrpc: Stablize TestInterceptors (#4535)
1 parent b44dfc9 commit f6aeb0d

File tree

1 file changed

+7
-0
lines changed
  • instrumentation/google.golang.org/grpc/otelgrpc/test

1 file changed

+7
-0
lines changed

instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"net"
2020
"strconv"
2121
"testing"
22+
"time"
2223

2324
"github.com/stretchr/testify/assert"
2425
"github.com/stretchr/testify/require"
@@ -136,6 +137,12 @@ func TestInterceptors(t *testing.T) {
136137
})
137138

138139
t.Run("StreamClientSpans", func(t *testing.T) {
140+
// StreamClientInterceptor ends the spans asynchronously.
141+
// We need to wait for all spans before asserting them.
142+
require.EventuallyWithT(t, func(c *assert.CollectT) {
143+
assert.Len(c, clientStreamSR.Ended(), 3)
144+
}, 5*time.Second, 100*time.Millisecond)
145+
139146
checkStreamClientSpans(t, clientStreamSR.Ended(), listener.Addr().String())
140147
})
141148

0 commit comments

Comments
 (0)