Skip to content

Commit f3a982f

Browse files
committed
feat(play): Simplify testing
1 parent a565097 commit f3a982f

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

dd-java-agent/instrumentation/play-2.3/src/test/groovy/datadog/trace/instrumentation/play23/test/server/PlayServerTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class PlayServerTest extends HttpServerTest<TestServer> {
5454
tags {
5555
"$Tags.COMPONENT" PlayHttpServerDecorator.DECORATE.component()
5656
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
57-
"$Tags.PEER_HOST_IPV4" { it == (endpoint == FORWARDED ? endpoint.body : "127.0.0.1") }
58-
"$Tags.HTTP_CLIENT_IP" { it == (endpoint == FORWARDED ? endpoint.body : "127.0.0.1") }
57+
"$Tags.PEER_HOST_IPV4" (endpoint == FORWARDED ? endpoint.body : "127.0.0.1")
58+
"$Tags.HTTP_CLIENT_IP" (endpoint == FORWARDED ? endpoint.body : "127.0.0.1")
5959
"$Tags.HTTP_URL" String
6060
"$Tags.HTTP_HOSTNAME" address.host
6161
"$Tags.HTTP_METHOD" String

dd-java-agent/instrumentation/play-2.4/src/test/groovy/datadog/trace/instrumentation/play25/server/PlayScalaRoutesServerTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ class PlayScalaRoutesServerTest extends PlayServerTest {
9898
tags {
9999
"$Tags.COMPONENT" 'play-action'
100100
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
101-
"$Tags.PEER_HOST_IPV4" { it == (endpoint == FORWARDED ? endpoint.body : '127.0.0.1') }
102-
"$Tags.HTTP_CLIENT_IP" { it == (endpoint == FORWARDED ? endpoint.body : '127.0.0.1') }
101+
"$Tags.PEER_HOST_IPV4" (endpoint == FORWARDED ? endpoint.body : '127.0.0.1')
102+
"$Tags.HTTP_CLIENT_IP" (endpoint == FORWARDED ? endpoint.body : '127.0.0.1')
103103
"$Tags.HTTP_URL" String
104104
"$Tags.HTTP_HOSTNAME" address.host
105105
"$Tags.HTTP_METHOD" String

dd-java-agent/instrumentation/play-2.4/src/test/groovy/datadog/trace/instrumentation/play25/server/PlayServerTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class PlayServerTest extends HttpServerTest<Server> {
130130
tags {
131131
"$Tags.COMPONENT" PlayHttpServerDecorator.DECORATE.component()
132132
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
133-
"$Tags.PEER_HOST_IPV4" { it == (endpoint == FORWARDED ? endpoint.body : "127.0.0.1") }
134-
"$Tags.HTTP_CLIENT_IP" { it == (endpoint == FORWARDED ? endpoint.body : "127.0.0.1") }
133+
"$Tags.PEER_HOST_IPV4" (endpoint == FORWARDED ? endpoint.body : "127.0.0.1")
134+
"$Tags.HTTP_CLIENT_IP" (endpoint == FORWARDED ? endpoint.body : "127.0.0.1")
135135
"$Tags.HTTP_URL" String
136136
"$Tags.HTTP_HOSTNAME" address.host
137137
"$Tags.HTTP_METHOD" String

dd-java-agent/instrumentation/play-2.6/src/baseTest/groovy/datadog/trace/instrumentation/play26/server/PlayServerTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class PlayServerTest extends HttpServerTest<Server> {
134134
"$Tags.COMPONENT" PlayHttpServerDecorator.DECORATE.component()
135135
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
136136
"$Tags.PEER_HOST_IPV4" '127.0.0.1'
137-
"$Tags.HTTP_CLIENT_IP" { it == (endpoint == FORWARDED ? endpoint.body : '127.0.0.1') }
137+
"$Tags.HTTP_CLIENT_IP" (endpoint == FORWARDED ? endpoint.body : '127.0.0.1')
138138
"$Tags.HTTP_URL" String
139139
"$Tags.HTTP_HOSTNAME" address.host
140140
"$Tags.HTTP_METHOD" String

dd-java-agent/instrumentation/play-2.6/src/latestDepTest/groovy/datadog/trace/instrumentation/play26/server/latestdep/PlayAsyncServerRoutesScalaWithErrorHandlerTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class PlayAsyncServerRoutesScalaWithErrorHandlerTest extends PlayServerWithError
8888
"$Tags.COMPONENT" PlayHttpServerDecorator.DECORATE.component()
8989
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
9090
"$Tags.PEER_HOST_IPV4" '127.0.0.1'
91-
"$Tags.HTTP_CLIENT_IP" { it == (endpoint == FORWARDED ? endpoint.body : "127.0.0.1") }
91+
"$Tags.HTTP_CLIENT_IP" (endpoint == FORWARDED ? endpoint.body : "127.0.0.1")
9292
"$Tags.HTTP_URL" String
9393
"$Tags.HTTP_HOSTNAME" address.host
9494
"$Tags.HTTP_METHOD" String

dd-java-agent/instrumentation/play-2.6/src/main/java/datadog/trace/instrumentation/play26/PlayAdvice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
44
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
5+
import static datadog.trace.bootstrap.instrumentation.api.Java8BytecodeBridge.getRootContext;
56
import static datadog.trace.bootstrap.instrumentation.api.Java8BytecodeBridge.spanFromContext;
67
import static datadog.trace.instrumentation.play26.PlayHttpServerDecorator.DECORATE;
78
import static datadog.trace.instrumentation.play26.PlayHttpServerDecorator.PLAY_REQUEST;
89

910
import datadog.context.Context;
1011
import datadog.context.ContextScope;
1112
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
12-
import datadog.trace.bootstrap.instrumentation.api.Java8BytecodeBridge;
1313
import datadog.trace.bootstrap.instrumentation.api.ResourceNamePriorities;
1414
import net.bytebuddy.asm.Advice;
1515
import play.api.mvc.Action;
@@ -39,7 +39,7 @@ public static ContextScope onEnter(@Advice.Argument(value = 0, readOnly = false)
3939
} else {
4040
// An upstream framework (e.g. akka-http, netty) has already started the span.
4141
// Do not extract the context.
42-
parentContext = Java8BytecodeBridge.getRootContext();
42+
parentContext = getRootContext();
4343
span = startSpan("play", PLAY_REQUEST);
4444
scope = span.attach();
4545
}

0 commit comments

Comments
 (0)