diff --git a/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/SpringListenerJms2Test.groovy b/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/SpringListenerJms2Test.groovy index 3b992cfd55..47d031a2e7 100644 --- a/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/SpringListenerJms2Test.groovy +++ b/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/SpringListenerJms2Test.groovy @@ -5,6 +5,8 @@ import static Jms2Test.consumerSpan import static Jms2Test.producerSpan +import static io.opentelemetry.api.trace.SpanKind.CONSUMER +import static io.opentelemetry.api.trace.SpanKind.PRODUCER import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import javax.jms.ConnectionFactory @@ -18,14 +20,13 @@ class SpringListenerJms2Test extends AgentInstrumentationSpecification { def context = new AnnotationConfigApplicationContext(Config) def factory = context.getBean(ConnectionFactory) def template = new JmsTemplate(factory) - // TODO(anuraaga): There is no defined order between when JMS starts receiving and our attempt - // to send/receive. Sleep a bit to let JMS start to receive first. Ideally, we would not have - // an ordering constraint in our assertTraces for when there is no defined ordering like this - // test case. + template.convertAndSend("SpringListenerJms2", "a message") expect: assertTraces(2) { + traces.sort(orderByRootSpanKind(CONSUMER, PRODUCER)) + trace(0, 1) { consumerSpan(it, 0, "queue", "SpringListenerJms2", "", null, "receive") }