Skip to content

Commit e1536cc

Browse files
committed
start appserver only once
1 parent 0eed1f6 commit e1536cc

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import io.opentelemetry.testing.internal.armeria.common.HttpMethod;
2727
import io.opentelemetry.testing.internal.armeria.common.RequestHeaders;
2828
import java.util.List;
29-
3029
import org.junit.jupiter.api.AfterAll;
3130
import org.junit.jupiter.api.BeforeEach;
3231
import org.junit.jupiter.api.Test;
@@ -101,26 +100,31 @@ void smokeTest() {
101100
.aggregate()
102101
.join();
103102

104-
assertFullTrace(path, response.contentUtf8());
103+
assertFullTrace(path, response.contentUtf8(), true);
105104
}
106105

107-
private void assertFullTrace(String path, String responseBody) {
106+
private void assertFullTrace(String path, String responseBody, boolean captureHeader) {
108107
testing()
109108
.waitAndAssertTraces(
110109
trace ->
111110
trace.hasSpansSatisfyingExactly(
112-
span -> assertServerSpan(span, path),
111+
span -> {
112+
assertServerSpan(span, path);
113+
if (captureHeader) {
114+
span.hasAttribute(
115+
AttributeKey.stringArrayKey("http.request.header.x-test-request"),
116+
List.of("test"));
117+
}
118+
},
113119
span ->
114120
assertSpan(span)
115121
.hasName("GET")
116122
.hasKind(SpanKind.CLIENT)
117123
.hasAttribute(
118-
AttributeKey.stringArrayKey("http.request.header.x-test-request"),
119-
List.of("test")),
124+
UrlAttributes.URL_FULL, "http://localhost:8080/app/headers"),
120125
span ->
121126
assertServerSpan(span, "/app/headers")
122-
.hasAttribute(ClientAttributes.CLIENT_ADDRESS, "127.0.0.1")
123-
.hasAttribute(UrlAttributes.URL_FULL, "http://localhost:8080" + path)));
127+
.hasAttribute(ClientAttributes.CLIENT_ADDRESS, "127.0.0.1")));
124128

125129
// trace id is present in the HTTP headers as reported by the called endpoint
126130
assertThat(responseBody).contains(testing().getSpanTraceIds().iterator().next());
@@ -208,7 +212,7 @@ void testRequestOutsideDeployedApplication() {
208212
void asyncSmokeTest() {
209213
String path = "/app/asyncgreeting";
210214
var response = testing().client().get(path).aggregate().join();
211-
assertFullTrace(path, response.contentUtf8());
215+
assertFullTrace(path, response.contentUtf8(), false);
212216
}
213217

214218
@Test

0 commit comments

Comments
 (0)