Skip to content

Commit

Permalink
Merge pull request quarkusio#45963 from holly-cummins/allow-asynchron…
Browse files Browse the repository at this point in the history
…ous-otel

Allow for asynchronousness in span processing in test
  • Loading branch information
geoand authored Jan 30, 2025
2 parents 0fa6c57 + 2c7889e commit 199ce85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static io.quarkus.it.opentelemetry.reactive.Utils.getSpans;
import static io.quarkus.it.opentelemetry.reactive.Utils.getSpansByKindAndParentId;
import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.when;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.stream.Collectors.toSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import static io.opentelemetry.api.trace.SpanKind.INTERNAL;
import static io.quarkus.it.opentelemetry.reactive.Utils.getSpanByKindAndParentId;
import static io.quarkus.it.opentelemetry.reactive.Utils.getSpans;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.net.URI;
import java.time.Duration;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -38,6 +40,14 @@ public class OpenTelemetryWithSpanAtStartupTest {

@Test
void testGeneratedSpansUsingRestClientReactive() {

// There's a bit of asynchronousness in recording and exporting the spans, so to avoid issues, give the startup spans a (small) moment to arrive
await().atMost(Duration.ofSeconds(5L)).pollDelay(Duration.ofMillis(50)).until(() -> {
// make sure incoming spans are processed
List<Map<String, Object>> spans = getSpans();
return spans.size() >= 1;
});

List<Map<String, Object>> spans = getSpans();
assertEquals(2, spans.size());

Expand Down

0 comments on commit 199ce85

Please sign in to comment.