Skip to content

Commit 375b3ca

Browse files
authored
Merge pull request #35077 from brunobat/test-resilience
Improve test resilience
2 parents 29a5f80 + 056023d commit 375b3ca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

integration-tests/opentelemetry/src/test/java/io/quarkus/it/opentelemetry/AbstractEndUserTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import static org.junit.jupiter.api.Assertions.assertTrue;
77

88
import java.util.List;
9+
import java.util.concurrent.TimeUnit;
910
import java.util.function.Predicate;
1011

1112
import jakarta.enterprise.inject.Instance;
@@ -42,7 +43,14 @@ public AbstractEndUserTest(Predicate<Instance<EndUserSpanProcessor>> predicate)
4243
@BeforeEach
4344
@AfterEach
4445
protected void reset() {
45-
inMemorySpanExporter.reset();
46+
await().atMost(5, TimeUnit.SECONDS).until(() -> {
47+
// make sure spans from previous tests are not included
48+
List<SpanData> finishedSpanItems = inMemorySpanExporter.getFinishedSpanItems();
49+
if (finishedSpanItems.size() > 0) {
50+
inMemorySpanExporter.reset();
51+
}
52+
return finishedSpanItems.size() == 0;
53+
});
4654
}
4755

4856
protected List<SpanData> getSpans() {

0 commit comments

Comments
 (0)