Skip to content

Commit 2220fb7

Browse files
committed
fix
1 parent 0690f51 commit 2220fb7

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

smoke-tests/src/test/java/io/opentelemetry/smoketest/appserver/AppServerTest.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ private void assertFullTrace(String path, String responseBody) {
9595
span -> assertServerSpan(span, path),
9696
span ->
9797
assertSpan(span)
98-
.hasName("GET " + path)
98+
.hasName("GET")
9999
.hasKind(SpanKind.CLIENT)
100100
.hasAttribute(ClientAttributes.CLIENT_ADDRESS, "127.0.0.1")
101101
.hasAttribute(
102102
AttributeKey.stringArrayKey("http.request.header.x-test-request"),
103103
List.of("test")),
104-
span -> assertServerSpan(span, "/app/headers")));
104+
span ->
105+
assertServerSpan(span, "/app/headers")
106+
.hasAttribute(UrlAttributes.URL_FULL, "http://localhost:8080" + path)));
105107

106108
// trace id is present in the HTTP headers as reported by the called endpoint
107109
assertThat(responseBody).contains(testing().getSpanTraceIds().iterator().next());
@@ -131,7 +133,10 @@ void testStaticFileNotFound() {
131133

132134
testing()
133135
.waitAndAssertTraces(
134-
trace -> trace.hasSpansSatisfyingExactly(span -> assertServerSpan(span, path)));
136+
trace ->
137+
trace.hasSpansSatisfyingExactly(
138+
span -> assertServerSpan(span, path),
139+
span -> span.hasName("Response.sendError").hasKind(SpanKind.INTERNAL)));
135140
}
136141

137142
@Test
@@ -143,7 +148,10 @@ void testRequestForWebInfWebXml() {
143148

144149
testing()
145150
.waitAndAssertTraces(
146-
trace -> trace.hasSpansSatisfyingExactly(span -> assertServerSpan(span, path)));
151+
trace ->
152+
trace.hasSpansSatisfyingExactly(
153+
span -> assertServerSpan(span, path),
154+
span -> span.hasName("Response.sendError").hasKind(SpanKind.INTERNAL)));
147155
}
148156

149157
@Test
@@ -161,7 +169,7 @@ void testRequestWithError() {
161169
assertServerSpan(span, path)
162170
.hasEventsSatisfyingExactly(
163171
event ->
164-
event.hasAttributesSatisfyingExactly(
172+
event.hasAttributesSatisfying(
165173
equalTo(
166174
AttributeKey.stringKey("exception.message"),
167175
"This is expected")))));
@@ -177,7 +185,12 @@ void testRequestOutsideDeployedApplication() {
177185

178186
testing()
179187
.waitAndAssertTraces(
180-
trace -> trace.hasSpansSatisfyingExactly(span -> assertServerSpan(span, path)));
188+
trace ->
189+
trace.hasSpansSatisfyingExactly(
190+
span -> assertServerSpan(span, path),
191+
span ->
192+
span.hasName("HttpServletResponseWrapper.sendError")
193+
.hasKind(SpanKind.INTERNAL)));
181194
}
182195

183196
@Test
@@ -201,7 +214,10 @@ void jspSmokeTestForSnippetInjection() {
201214
if (expectServerSpan()) {
202215
testing()
203216
.waitAndAssertTraces(
204-
trace -> trace.hasSpansSatisfyingExactly(span -> assertServerSpan(span, "/app/jsp")));
217+
trace ->
218+
trace.hasSpansSatisfyingExactly(
219+
span -> span.hasName("GET /app/jsp").hasKind(SpanKind.SERVER),
220+
span -> span.hasName("Compile /test.jsp").hasKind(SpanKind.INTERNAL)));
205221
}
206222
}
207223

@@ -239,7 +255,6 @@ private SpanDataAssert assertServerSpan(SpanDataAssert span, String path) {
239255
return assertSpan(span)
240256
.hasName(getSpanName(path))
241257
.hasKind(SpanKind.SERVER)
242-
.hasAttribute(UrlAttributes.URL_PATH, path)
243-
.hasAttribute(UrlAttributes.URL_FULL, "http://localhost:8080" + path);
258+
.hasAttribute(UrlAttributes.URL_PATH, path);
244259
}
245260
}

0 commit comments

Comments
 (0)