Skip to content

Commit

Permalink
refine ut
Browse files Browse the repository at this point in the history
  • Loading branch information
shalk committed Sep 23, 2024
1 parent b77c267 commit 04b78e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.QUERY_PARAM;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.REDIRECT;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS;
import static java.util.Collections.singletonList;

import com.google.common.collect.ImmutableSet;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension;
Expand All @@ -24,8 +24,6 @@
import io.undertow.util.Headers;
import io.undertow.util.HttpString;
import io.undertow.util.StatusCodes;
import java.util.Collections;
import java.util.HashSet;
import org.junit.jupiter.api.extension.RegisterExtension;

class UndertowServerDispatchTest extends AbstractHttpServerTest<Undertow> {
Expand Down Expand Up @@ -139,9 +137,6 @@ protected void configure(HttpServerTestOptions options) {
options.setTestException(false);
options.setHasResponseCustomizer(endpoint -> true);

options.setHttpAttributes(
endpoint ->
Collections.unmodifiableSet(
new HashSet<>(singletonList(NetworkAttributes.NETWORK_PEER_PORT))));
options.setHttpAttributes(endpoint -> ImmutableSet.of(NetworkAttributes.NETWORK_PEER_PORT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies;
import static java.util.Collections.singletonList;
import static org.assertj.core.api.Assertions.assertThat;

import com.google.common.collect.ImmutableSet;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
Expand All @@ -38,13 +38,10 @@
import io.undertow.util.HttpString;
import io.undertow.util.StatusCodes;
import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

// TODO make test which mixes handlers and servlets
class UndertowServerTest extends AbstractHttpServerTest<Undertow> {

@RegisterExtension
Expand Down Expand Up @@ -178,10 +175,7 @@ public void stopServer(Undertow undertow) {
@Override
protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setHttpAttributes(
endpoint ->
Collections.unmodifiableSet(
new HashSet<>(singletonList(NetworkAttributes.NETWORK_PEER_PORT))));
options.setHttpAttributes(endpoint -> ImmutableSet.of(NetworkAttributes.NETWORK_PEER_PORT));
options.setHasResponseCustomizer(serverEndpoint -> true);
options.setUseHttp2(useHttp2());
}
Expand Down Expand Up @@ -235,7 +229,7 @@ void testSendResponse() {

@Test
@DisplayName("test send response with exception")
void testSendReponseWithException() {
void testSendResponseWithException() {
URI uri = address.resolve("sendResponseWithException");
AggregatedHttpResponse response = client.get(uri.toString()).aggregate().join();

Expand Down

0 comments on commit 04b78e4

Please sign in to comment.