-
I am having issues in setting the spring.rabbitmq.port setting based on my test container. My development environment works find starting it When I convert it to a TestContainer
I get a random port: RABBIT CONTAINER HOST localhost, AMQP 62883 and the spring context fails to connect using 5672 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I highly recommend reading the Getting started with Testcontainers. If you are using spring boot then before 3.1 you can use |
Beta Was this translation helpful? Give feedback.
JUnit 5 5.9.3
Testcontainers 1.19.1
Manually starting? yes
Lifecycle container? @testcontainers()
The localstack container defined in an individual test class in another microservice was working with
@Containter and @DynamicPropertySource.
Well after hours of debugging I noticed when I changed from @container to static blocks because RabbitMQ has static ports in their class so I was exposing ports and doing port bindings, the
@DynamicPropertySource
ended up between multiple static blocks. When I moved the ```@DynamicPropertySrouce`` after the static blocks it worked. Rookie mistake.I since have gone back to
@Container
for all the containers except the RabbitMQ container.