Make regular test less flaky too
MODIFY
dd-java-agent/instrumentation/jms/src/test/groovy/SpringListenerJMS1Test.groovy
dd-java-agent/instrumentation/jms/src/test/groovy/SpringListenerJMS1Test.groovy
@@ -35,7 +35,7 @@ class SpringListenerJMS1Test extends AgentTestRunner {
def context = new AnnotationConfigApplicationContext(Config)
def factory = context.getBean(ConnectionFactory)
def template = new JmsTemplate(factory)
- template.convertAndSend("someSpringQueue", "a message")
+ template.convertAndSend("SpringListenerJMS1", "a message")
TEST_WRITER.waitForTraces(3)
// Manually reorder if reported in the wrong order.
@@ -47,9 +47,9 @@ class SpringListenerJMS1Test extends AgentTestRunner {
expect:
assertTraces(3) {
- producerTrace(it, 0, "Queue someSpringQueue")
- consumerTrace(it, 1, "Queue someSpringQueue", false, ActiveMQMessageConsumer)
- consumerTrace(it, 2, "Queue someSpringQueue", true, MessagingMessageListenerAdapter)
+ producerTrace(it, 0, "Queue SpringListenerJMS1")
+ consumerTrace(it, 1, "Queue SpringListenerJMS1", false, ActiveMQMessageConsumer)
+ consumerTrace(it, 2, "Queue SpringListenerJMS1", true, MessagingMessageListenerAdapter)
}
cleanup:

MODIFY
dd-java-agent/instrumentation/jms/src/test/groovy/SpringTemplateJMS1Test.groovy
dd-java-agent/instrumentation/jms/src/test/groovy/SpringTemplateJMS1Test.groovy
@@ -56,7 +56,7 @@ class SpringTemplateJMS1Test extends AgentTestRunner {
where:
destination | jmsResourceName
- session.createQueue("someSpringQueue") | "Queue someSpringQueue"
+ session.createQueue("SpringTemplateJMS1") | "Queue SpringTemplateJMS1"
}
def "send and receive message generates spans"() {
@@ -100,6 +100,6 @@ class SpringTemplateJMS1Test extends AgentTestRunner {
where:
destination | jmsResourceName
- session.createQueue("someSpringQueue") | "Queue someSpringQueue"
+ session.createQueue("SpringTemplateJMS1") | "Queue SpringTemplateJMS1"
}
}

MODIFY
dd-java-agent/instrumentation/jms/src/test/groovy/listener/Config.groovy
dd-java-agent/instrumentation/jms/src/test/groovy/listener/Config.groovy
@@ -23,6 +23,7 @@ import org.springframework.jms.annotation.EnableJms
import org.springframework.jms.config.DefaultJmsListenerContainerFactory
import org.springframework.jms.config.JmsListenerContainerFactory
+import javax.annotation.PreDestroy
import javax.jms.ConnectionFactory
@Configuration
@@ -48,4 +49,9 @@ class Config {
factory.setConnectionFactory(connectionFactory)
return factory
}
+
+ @PreDestroy
+ void destroy() {
+ broker().stop()
+ }
}

MODIFY
dd-java-agent/instrumentation/jms/src/test/groovy/listener/TestListener.groovy
dd-java-agent/instrumentation/jms/src/test/groovy/listener/TestListener.groovy
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component
@Component
class TestListener {
- @JmsListener(destination = "someSpringQueue", containerFactory = "containerFactory")
+ @JmsListener(destination = "SpringListenerJMS1", containerFactory = "containerFactory")
void receiveMessage(String message) {
println "received: " + message
}

Make regular test less flaky too