From 32e3deb9cf5e96148b91f7a8aa45b557ef709d98 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 6 Dec 2021 11:57:33 -0800 Subject: [PATCH] Update tests now that netty captures http.scheme (#4807) --- .../ratpack/server/AbstractRatpackRoutesTest.groovy | 3 +-- .../instrumentation/test/base/HttpServerTest.groovy | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/instrumentation/ratpack-1.4/testing/src/main/groovy/io/opentelemetry/instrumentation/ratpack/server/AbstractRatpackRoutesTest.groovy b/instrumentation/ratpack-1.4/testing/src/main/groovy/io/opentelemetry/instrumentation/ratpack/server/AbstractRatpackRoutesTest.groovy index 9fbeec74e8..5dfe780fa5 100644 --- a/instrumentation/ratpack-1.4/testing/src/main/groovy/io/opentelemetry/instrumentation/ratpack/server/AbstractRatpackRoutesTest.groovy +++ b/instrumentation/ratpack-1.4/testing/src/main/groovy/io/opentelemetry/instrumentation/ratpack/server/AbstractRatpackRoutesTest.groovy @@ -117,8 +117,7 @@ abstract class AbstractRatpackRoutesTest extends InstrumentationSpecification { if (extraAttributes.contains(SemanticAttributes.HTTP_URL)) { "$SemanticAttributes.HTTP_URL" "http://localhost:${app.bindPort}/${path}" } else { - // TODO netty does not set http.scheme - refactor HTTP server tests so that it's possible to specify extracted attributes, like in HTTP client tests - "$SemanticAttributes.HTTP_SCHEME" { it == "http" || it == null } + "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:${app.bindPort}" "$SemanticAttributes.HTTP_TARGET" "/$path" } diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy index 03035b3eb6..6aa835b55e 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy @@ -666,8 +666,7 @@ abstract class HttpServerTest extends InstrumentationSpecification imple "$SemanticAttributes.HTTP_USER_AGENT" TEST_USER_AGENT "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } - // TODO netty does not set http.scheme - refactor HTTP server tests so that it's possible to specify extracted attributes, like in HTTP client tests - "$SemanticAttributes.HTTP_SCHEME" { it == "http" || it == null } + "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_TARGET" endpoint.resolvePath(address).getPath() + "${endpoint == QUERY_PARAM ? "?${endpoint.body}" : ""}" if (extraAttributes.contains(SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH)) {