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

Ignore span oder in flaky test #6060

Merged
merged 2 commits into from
May 18, 2022
Merged
Changes from 1 commit
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 @@ -22,6 +22,7 @@
import java.net.URI;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -554,14 +555,25 @@ void connectionErrorUnopenedPortWithCallback() throws Exception {

testing.waitAndAssertTraces(
trace -> {
trace.hasSpansSatisfyingExactly(
span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(),
span ->
assertClientSpan(span, uri, method, null)
.hasParent(trace.getSpan(0))
.hasException(clientError),
span ->
span.hasName("callback").hasKind(SpanKind.INTERNAL).hasParent(trace.getSpan(0)));
List<Consumer<SpanDataAssert>> spanAsserts =
Arrays.asList(
span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(),
span ->
assertClientSpan(span, uri, method, null)
.hasParent(trace.getSpan(0))
.hasException(clientError),
span ->
span.hasName("callback")
.hasKind(SpanKind.INTERNAL)
.hasParent(trace.getSpan(0)));
boolean jdk8 = "1.8".equals(System.getProperty("java.specification.version"));
if (jdk8) {
// on some netty based http clients odering of `CONNECT` and `callback` span isn't
// guranteed when running on jdk8
trace.hasSpansSatisfyingExactlyInAnyOrder(spanAsserts);
} else {
trace.hasSpansSatisfyingExactly(spanAsserts);
}
});
}

Expand Down