Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert trace only once #12346

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.assertj.core.api.ListAssert;
import org.awaitility.core.ConditionTimeoutException;

/**
* This interface defines a common set of operations for interaction with OpenTelemetry SDK and
Expand Down Expand Up @@ -118,25 +117,7 @@ private <T extends Consumer<TraceAssert>> void waitAndAssertTraces(
List<T> assertionsList = new ArrayList<>();
assertions.forEach(assertionsList::add);

try {
await()
.untilAsserted(() -> doAssertTraces(traceComparator, assertionsList, verifyScopeVersion));
} catch (Throwable t) {
// awaitility is doing a jmx call that is not implemented in GraalVM:
// call:
// https://github.com/awaitility/awaitility/blob/fbe16add874b4260dd240108304d5c0be84eabc8/awaitility/src/main/java/org/awaitility/core/ConditionAwaiter.java#L157
// see https://github.com/oracle/graal/issues/6101 (spring boot graal native image)
if (t.getClass().getName().equals("com.oracle.svm.core.jdk.UnsupportedFeatureError")
|| t instanceof ConditionTimeoutException) {
// Don't throw this failure since the stack is the awaitility thread, causing confusion.
// Instead, just assert one more time on the test thread, which will fail with a better
// stack trace.
// TODO(anuraaga): There is probably a better way to do this.
doAssertTraces(traceComparator, assertionsList, verifyScopeVersion);
} else {
throw t;
}
}
doAssertTraces(traceComparator, assertionsList, verifyScopeVersion);
}

private <T extends Consumer<TraceAssert>> void doAssertTraces(
Expand Down
Loading