Skip to content

Commit

Permalink
fix failing opencensus tests (#1021)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-lang authored Oct 9, 2020
1 parent 8480b28 commit 6c17021
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 8 additions & 2 deletions tracing/opencensus/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func TestGRPCClientTrace(t *testing.T) {
}

for _, tr := range traces {
clientTracer := ockit.GRPCClientTrace(ockit.WithName(tr.name))
clientTracer := ockit.GRPCClientTrace(
ockit.WithName(tr.name),
ockit.WithSampler(trace.AlwaysSample()),
)

ep := grpctransport.NewClient(
cc,
Expand Down Expand Up @@ -136,7 +139,10 @@ func TestGRPCServerTrace(t *testing.T) {
func(context.Context, interface{}) (interface{}, error) {
return nil, tr.err
},
ockit.GRPCServerTrace(ockit.WithName(tr.name)),
ockit.GRPCServerTrace(
ockit.WithName(tr.name),
ockit.WithSampler(trace.AlwaysSample()),
),
)

if tr.useParent {
Expand Down
9 changes: 8 additions & 1 deletion tracing/opencensus/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ func TestHTTPClientTrace(t *testing.T) {
}

for _, tr := range traces {
clientTracer := ockit.HTTPClientTrace(ockit.WithName(tr.name))
clientTracer := ockit.HTTPClientTrace(
ockit.WithName(tr.name),
ockit.WithSampler(trace.AlwaysSample()),
)
ep := kithttp.NewClient(
"GET",
rURL,
Expand Down Expand Up @@ -117,6 +120,7 @@ func TestHTTPServerTrace(t *testing.T) {
func(context.Context, http.ResponseWriter, interface{}) error { return errors.New("dummy") },
ockit.HTTPServerTrace(
ockit.WithName(tr.name),
ockit.WithSampler(trace.AlwaysSample()),
ockit.WithHTTPPropagation(tr.propagation),
),
)
Expand All @@ -134,6 +138,9 @@ func TestHTTPServerTrace(t *testing.T) {
if tr.useParent {
client = http.Client{
Transport: &ochttp.Transport{
StartOptions: trace.StartOptions{
Sampler: trace.AlwaysSample(),
},
Propagation: tr.propagation,
},
}
Expand Down

0 comments on commit 6c17021

Please sign in to comment.