🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Not able to connect the solace container with testcontainers module in java

aditya
aditya Member Posts: 7
edited March 2023 in Connectors & Integrations #1

I am trying to connect the solace container with java testcontainer 1.17.6 module but not able to connect everytime. I am getting the below error:

Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed

at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:349)

at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)

at com.solace.junit.AbstractPubSubPlusTestCase.<clinit>(AbstractPubSubPlusTestCase.java:76)

... 22 more

Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception

at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)

at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:334)

... 24 more

Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container

at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:542)

at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:344)

at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)

... 25 more

Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [54997, 54998, 54999, 55000, 55001, 55002, 55003] should be listening)

at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:102)

at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52)

at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:953)

at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:485)

... 27 more

I have tried to connect using the below code

https://github.com/solace-iot-team/pubsubplus-container-junit/blob/main/src/main/java/com/solace/junit/AbstractPubSubPlusTestCase.java

Sometimes it is connecting sometimes it is giving the above error. What settings should I apply so that we can connect the container every time. I have also notice that the solace container works after sometime.

Comments

  • amackenzie
    amackenzie Member, Employee Posts: 269 Solace Employee

    Have you looked at this thread: https://solace.community/discussion/comment/5286

    It seems like it could be related.

    Also, when pasting code or logs, can you format them with a code block? It makes it much easier to read.

  • aditya
    aditya Member Posts: 7
    edited March 2023 #3

    Hi @amackenzie, Sorry I will look into the format issue next time. Yes I have looked into this thread and I am not using that port but still I am getting the same issue. Please check the below code

    solace = new GenericContainer<>("solace/solace-pubsub-standard:latest").withExposedPorts(55555, 8080,8000,9000,1883,5672)
            .withSharedMemorySize(1000000000L).withEnv("username_admin_globalaccesslevel", ADMIN_USER)
            .withEnv("username_admin_password", ADMIN_PASSWORD).withEnv("system_scaling_interconnection", "1500")
            .withMinimumRunningDuration(Duration.ofSeconds(300));
    

    Also I have tried by adding waitingFor(Wait.forListeningPort() but no luck.

    I am using the testcontainers 1.17.6

  • swenhelge
    swenhelge Member, Employee Posts: 80 Solace Employee

    Hi,

    That is a repo I created a couple of years back.

    I never ran into a problem like this - it seems it is intermittent?

    The best option would be to see if you can extract the broker log from the docker container in case of failure somehow?

    And also capture a complete JUnit test log and upload it.

  • swenhelge
    swenhelge Member, Employee Posts: 80 Solace Employee

    While I never saw the issue you encounter there may be two alternative approaches that may help ..

    Using JUnit5: https://github.com/spierepf/solace-junit5-test

    Or this here on the testcontainers site - https://www.testcontainers.org/modules/solace/

  • aditya
    aditya Member Posts: 7

    @swenhelge You are correct the issue seems intermittent. I have reinstalled the docker desktop and after that it is working fine. I will still check and if I face the issue again I will send you the logs . Also I will check the alternative approach. Thanks a lot for helping me.