Skip to content

Commit

Permalink
refine ut
Browse files Browse the repository at this point in the history
  • Loading branch information
shalk committed Dec 4, 2024
1 parent c63a933 commit 6dea116
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package server;
package io.opentelemetry.javaagent.instrumentation.vertx;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package server;
package io.opentelemetry.javaagent.instrumentation.vertx;

import io.vertx.core.Promise;
import io.vertx.core.http.HttpServerResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package server;
package io.opentelemetry.javaagent.instrumentation.vertx;

import io.vertx.core.AbstractVerticle;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package server;
package io.opentelemetry.javaagent.instrumentation.vertx;

import io.vertx.core.Future;
import io.vertx.core.http.HttpServerResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package server;

import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION;
package io.opentelemetry.javaagent.instrumentation.vertx;

import io.opentelemetry.instrumentation.api.internal.HttpConstants;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
Expand All @@ -32,23 +30,21 @@ abstract class AbstractVertxHttpServerTest extends AbstractHttpServerTest<Vertx>

@Override
protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setTestPathParam(true);
// server spans are ended inside of the controller spans
options.setVerifyServerSpanEndTime(false);
options.setContextPath("/vertx-app");
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
super.configure(options);
}

@Override
public String expectedHttpRoute(ServerEndpoint endpoint, String method) {
if (Objects.equals(method, HttpConstants._OTHER)) {
return getContextPath() + endpoint.getPath();
}
if (Objects.equals(endpoint, ServerEndpoint.NOT_FOUND)) {
return getContextPath();
}
return super.expectedHttpRoute(endpoint, method);
options.setExpectedHttpRoute(
(endpoint, method) -> {
if (Objects.equals(method, HttpConstants._OTHER)) {
return getContextPath() + endpoint.getPath();
}
if (Objects.equals(endpoint, ServerEndpoint.NOT_FOUND)) {
return getContextPath();
}
return super.expectedHttpRoute(endpoint, method);
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package server;
package io.opentelemetry.javaagent.instrumentation.vertx;

import static io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest.controller;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.CAPTURE_HEADERS;
Expand Down

0 comments on commit 6dea116

Please sign in to comment.