From 1627b8564e2eb101a9d30d2450b4cd668af08f53 Mon Sep 17 00:00:00 2001 From: Ryan Lang Date: Fri, 9 Oct 2020 12:01:48 -0700 Subject: [PATCH] fix failing opencensus tests --- tracing/opencensus/grpc_test.go | 10 ++++++++-- tracing/opencensus/http_test.go | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tracing/opencensus/grpc_test.go b/tracing/opencensus/grpc_test.go index cdb12aead..be396d132 100644 --- a/tracing/opencensus/grpc_test.go +++ b/tracing/opencensus/grpc_test.go @@ -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, @@ -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 { diff --git a/tracing/opencensus/http_test.go b/tracing/opencensus/http_test.go index 78ff7d587..7f42c548b 100644 --- a/tracing/opencensus/http_test.go +++ b/tracing/opencensus/http_test.go @@ -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, @@ -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), ), ) @@ -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, }, }