Add startup check to all rabitmq container usages
MODIFY
instrumentation/spring/spring-integration-4.1/testing/src/main/groovy/WithRabbitProducerConsumerTrait.groovy
instrumentation/spring/spring-integration-4.1/testing/src/main/groovy/WithRabbitProducerConsumerTrait.groovy
@@ -15,6 +15,7 @@ import org.springframework.context.ConfigurableApplicationContext
import org.springframework.context.annotation.Bean
import org.springframework.messaging.support.MessageBuilder
import org.testcontainers.containers.GenericContainer
+import org.testcontainers.containers.wait.strategy.Wait
import java.time.Duration
@@ -30,7 +31,8 @@ trait WithRabbitProducerConsumerTrait {
def startRabbit(Class<?> additionalContext = null) {
rabbitMqContainer = new GenericContainer('rabbitmq:latest')
.withExposedPorts(5672)
- .withStartupTimeout(Duration.ofSeconds(120))
+ .waitingFor(Wait.forLogMessage(".*Server startup complete.*", 1))
+ .withStartupTimeout(Duration.ofMinutes(2))
rabbitMqContainer.start()
def producerApp = new SpringApplication(getContextClasses(ProducerConfig, additionalContext))

MODIFY
instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy
instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy
@@ -15,6 +15,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.ConfigurableApplicationContext
import org.springframework.context.annotation.Bean
import org.testcontainers.containers.GenericContainer
+import org.testcontainers.containers.wait.strategy.Wait
import spock.lang.Shared
import java.time.Duration
@@ -37,7 +38,8 @@ class ContextPropagationTest extends AgentInstrumentationSpecification {
def setupSpec() {
rabbitMqContainer = new GenericContainer('rabbitmq:latest')
.withExposedPorts(5672)
- .withStartupTimeout(Duration.ofSeconds(120))
+ .waitingFor(Wait.forLogMessage(".*Server startup complete.*", 1))
+ .withStartupTimeout(Duration.ofMinutes(2))
rabbitMqContainer.start()
def app = new SpringApplication(ConsumerConfig)

Add startup check to all rabitmq container usages (#4893)