From 2bcae0b0101010e3cfd497b6a8b44e2a8eb89066 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Thu, 16 Nov 2023 17:58:23 +0200 Subject: [PATCH] Fix flaky aws2 sqs test (#9888) --- .../awssdk/v2_2/AbstractAws2SqsTracingTest.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.groovy b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.groovy index 41ac5d1296..7cf38cc44b 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.groovy @@ -431,6 +431,17 @@ abstract class AbstractAws2SqsTracingTest extends InstrumentationSpecification { "$SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH" { it == null || it instanceof Long } } } + if (!xrayInjectionEnabled) { + // one of the 3 process spans is expected to not have a span link, sort them so that the + // last one is the one with missing link + if (spans.get(1).links.empty) { + spans.swap(1, 5) + spans.swap(2, 6) + } else if (spans.get(3).links.empty) { + spans.swap(3, 5) + spans.swap(4, 6) + } + } for (int i: 0..2) { span(1 + 2*i) { name "testSdkSqs process"