-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22750 from radcortez/fix-20698
Use configured root-path and non-application-root-path to configure the NonApplicationEndpointSampler
- Loading branch information
Showing
2 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...est/java/io/quarkus/opentelemetry/deployment/NonAppEndpointsDisabledWithRootPathTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.quarkus.opentelemetry.deployment; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class NonAppEndpointsDisabledWithRootPathTest { | ||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClass(TracerRouter.class) | ||
.addClass(TestSpanExporter.class)) | ||
.overrideConfigKey("quarkus.http.root-path", "/app") | ||
.overrideConfigKey("quarkus.http.non-application-root-path", "quarkus"); | ||
|
||
@Inject | ||
TestSpanExporter testSpanExporter; | ||
|
||
@Test | ||
void testHealthEndpointNotTraced() { | ||
RestAssured.when().get("/quarkus/health").then() | ||
.statusCode(200) | ||
.body(containsString("\"status\": \"UP\"")); | ||
|
||
RestAssured.when().get("/quarkus/health/live").then() | ||
.statusCode(200) | ||
.body(containsString("\"status\": \"UP\"")); | ||
|
||
RestAssured.when().get("/quarkus/health/ready").then() | ||
.statusCode(200) | ||
.body(containsString("\"status\": \"UP\"")); | ||
|
||
RestAssured.when().get("/tracer").then() | ||
.statusCode(200) | ||
.body(is("Hello Tracer!")); | ||
|
||
testSpanExporter.assertSpanCount(2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters