Add debug logging to SpringTemplateJms1Test (#5087)
This commit is contained in:
parent
f7da97bd9d
commit
0624b6561e
|
@ -112,7 +112,6 @@ class SpringTemplateJms2Test extends AgentInstrumentationSpecification {
|
|||
session -> template.getMessageConverter().toMessage("responded!", session)
|
||||
}
|
||||
}
|
||||
// wait for thread to start, we expect the first span to be from receive
|
||||
TextMessage receivedMessage = template.sendAndReceive(destination) {
|
||||
session -> template.getMessageConverter().toMessage(messageText, session)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import static Jms1Test.consumerSpan
|
|||
import static Jms1Test.producerSpan
|
||||
|
||||
class SpringTemplateJms1Test extends AgentInstrumentationSpecification {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SpringTemplateJms1Test)
|
||||
private static final Logger logger = LoggerFactory.getLogger("io.opentelemetry.SpringTemplateJms1Test")
|
||||
|
||||
private static final GenericContainer broker = new GenericContainer("rmohr/activemq:latest")
|
||||
.withExposedPorts(61616, 8161)
|
||||
|
@ -78,10 +78,12 @@ class SpringTemplateJms1Test extends AgentInstrumentationSpecification {
|
|||
setup:
|
||||
AtomicReference<String> msgId = new AtomicReference<>()
|
||||
Thread.start {
|
||||
logger.info("calling receive")
|
||||
TextMessage msg = template.receive(destination)
|
||||
assert msg.text == messageText
|
||||
msgId.set(msg.getJMSMessageID())
|
||||
|
||||
logger.info("calling send")
|
||||
template.send(msg.getJMSReplyTo()) {
|
||||
session -> template.getMessageConverter().toMessage("responded!", session)
|
||||
}
|
||||
|
@ -89,13 +91,16 @@ class SpringTemplateJms1Test extends AgentInstrumentationSpecification {
|
|||
def receivedMessage
|
||||
def stopwatch = Stopwatch.createStarted()
|
||||
while (receivedMessage == null && stopwatch.elapsed(TimeUnit.SECONDS) < 10) {
|
||||
logger.info("calling sendAndReceive")
|
||||
// sendAndReceive() returns null if template.receive() has not been called yet
|
||||
receivedMessage = template.sendAndReceive(destination) {
|
||||
session -> template.getMessageConverter().toMessage(messageText, session)
|
||||
}
|
||||
logger.info("received message " + receivedMessage)
|
||||
}
|
||||
|
||||
expect:
|
||||
receivedMessage != null
|
||||
receivedMessage.text == "responded!"
|
||||
assertTraces(4) {
|
||||
traces.sort(orderByRootSpanName(
|
||||
|
|
Loading…
Reference in New Issue