|
5 | 5 |
|
6 | 6 | package io.opentelemetry.javaagent.instrumentation.pekkohttp.v1_0 |
7 | 7 |
|
8 | | -import io.opentelemetry.api.trace.Span |
9 | | -import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._ |
10 | | -import io.opentelemetry.instrumentation.testing.junit.http.{ |
11 | | - AbstractHttpServerTest, |
12 | | - ServerEndpoint |
13 | | -} |
14 | 8 | import org.apache.pekko.actor.ActorSystem |
15 | 9 | import org.apache.pekko.http.scaladsl.Http |
16 | 10 | import org.apache.pekko.http.scaladsl.Http.ServerBinding |
17 | | -import org.apache.pekko.http.scaladsl.model.HttpMethods.{GET, POST} |
18 | | -import org.apache.pekko.http.scaladsl.model.StatusCodes.OK |
| 11 | +import org.apache.pekko.http.scaladsl.model.HttpMethods.GET |
19 | 12 | import org.apache.pekko.http.scaladsl.model._ |
20 | | -import org.apache.pekko.pattern.after |
21 | 13 | import org.apache.pekko.stream.ActorMaterializer |
| 14 | +import io.opentelemetry.instrumentation.testing.junit.http.{ |
| 15 | + AbstractHttpServerTest, |
| 16 | + ServerEndpoint |
| 17 | +} |
| 18 | +import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._ |
22 | 19 |
|
23 | 20 | import java.util.function.Supplier |
24 | | -import scala.concurrent.duration.DurationInt |
25 | 21 | import scala.concurrent.{Await, ExecutionContextExecutor, Future} |
26 | 22 |
|
27 | 23 | object PekkoHttpTestAsyncWebServer { |
@@ -61,26 +57,6 @@ object PekkoHttpTestAsyncWebServer { |
61 | 57 | } |
62 | 58 | ) |
63 | 59 | } |
64 | | - case HttpRequest(POST, uri: Uri, _, _, _) => |
65 | | - val endpoint = ServerEndpoint.forPath(uri.path.toString()) |
66 | | - AbstractHttpServerTest.controller( |
67 | | - endpoint, |
68 | | - () => |
69 | | - for { |
70 | | - _ <- Future.successful(2) |
71 | | - firstSpanContext = Span.current().getSpanContext() |
72 | | - _ <- after(1.second, system.scheduler)(Future.successful(1)) |
73 | | - secondSpanContext = Span.current().getSpanContext() |
74 | | - _ = require( |
75 | | - firstSpanContext.getTraceId() == secondSpanContext.getTraceId(), |
76 | | - s"TraceId ${firstSpanContext.getTraceId()} did not match ${secondSpanContext.getTraceId()}" |
77 | | - ) |
78 | | - _ = require( |
79 | | - firstSpanContext.getSpanId() == secondSpanContext.getSpanId(), |
80 | | - s"SpanId ${firstSpanContext.getSpanId()} did not match ${secondSpanContext.getSpanId()}" |
81 | | - ) |
82 | | - } yield HttpResponse(status = OK, entity = endpoint.getBody) |
83 | | - ) |
84 | 60 | } |
85 | 61 |
|
86 | 62 | private var binding: ServerBinding = _ |
|
0 commit comments