|
23 | 23 |
|
24 | 24 | import com.spotify.github.tracing.opencensus.OpenCensusTracer;
|
25 | 25 | import io.grpc.Context;
|
26 |
| -import io.opencensus.trace.*; |
27 | 26 | import io.opencensus.trace.Span;
|
| 27 | +import io.opencensus.trace.*; |
28 | 28 | import io.opencensus.trace.config.TraceConfig;
|
29 | 29 | import io.opencensus.trace.config.TraceParams;
|
30 | 30 | import io.opencensus.trace.export.SpanData;
|
31 | 31 | import io.opencensus.trace.samplers.Samplers;
|
32 | 32 | import io.opencensus.trace.unsafe.ContextUtils;
|
33 |
| -import org.junit.jupiter.api.BeforeEach; |
| 33 | +import okhttp3.Call; |
| 34 | +import okhttp3.OkHttpClient; |
34 | 35 | import org.junit.jupiter.api.BeforeAll;
|
| 36 | +import org.junit.jupiter.api.BeforeEach; |
35 | 37 | import org.junit.jupiter.api.Test;
|
36 | 38 |
|
37 | 39 | import java.util.List;
|
|
40 | 42 |
|
41 | 43 | import static io.opencensus.trace.AttributeValue.stringAttributeValue;
|
42 | 44 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
| 45 | +import static org.junit.jupiter.api.Assertions.assertNotNull; |
43 | 46 |
|
44 | 47 | public class OpenCensusTracerTest {
|
45 | 48 |
|
@@ -104,6 +107,14 @@ public void testTrace_CompletionStage_Fails() throws Exception {
|
104 | 107 | assertEquals(Status.UNKNOWN, inner.getStatus());
|
105 | 108 | }
|
106 | 109 |
|
| 110 | + @Test |
| 111 | + public void test_createTracedClient() { |
| 112 | + OpenCensusTracer tracer = new OpenCensusTracer(); |
| 113 | + OkHttpClient client = new OkHttpClient.Builder().build(); |
| 114 | + Call.Factory callFactory = tracer.createTracedClient(client); |
| 115 | + assertNotNull(callFactory); |
| 116 | + } |
| 117 | + |
107 | 118 | private io.opencensus.trace.Span startRootSpan() {
|
108 | 119 | Span rootSpan = Tracing.getTracer().spanBuilder(rootSpanName).startSpan();
|
109 | 120 | Context context = ContextUtils.withValue(Context.current(), rootSpan);
|
|
0 commit comments