Fix flaky spring jms test (#3336)
This commit is contained in:
parent
3e28b01e42
commit
f77e8457fc
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
import static Jms2Test.consumerSpan
|
import static Jms2Test.consumerSpan
|
||||||
import static Jms2Test.producerSpan
|
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 io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import javax.jms.ConnectionFactory
|
import javax.jms.ConnectionFactory
|
||||||
|
@ -18,14 +20,13 @@ class SpringListenerJms2Test extends AgentInstrumentationSpecification {
|
||||||
def context = new AnnotationConfigApplicationContext(Config)
|
def context = new AnnotationConfigApplicationContext(Config)
|
||||||
def factory = context.getBean(ConnectionFactory)
|
def factory = context.getBean(ConnectionFactory)
|
||||||
def template = new JmsTemplate(factory)
|
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")
|
template.convertAndSend("SpringListenerJms2", "a message")
|
||||||
|
|
||||||
expect:
|
expect:
|
||||||
assertTraces(2) {
|
assertTraces(2) {
|
||||||
|
traces.sort(orderByRootSpanKind(CONSUMER, PRODUCER))
|
||||||
|
|
||||||
trace(0, 1) {
|
trace(0, 1) {
|
||||||
consumerSpan(it, 0, "queue", "SpringListenerJms2", "", null, "receive")
|
consumerSpan(it, 0, "queue", "SpringListenerJms2", "", null, "receive")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue