Skip to content

LogMessageWaitStrategy does not work for compose based restarting containersΒ #2881

@Mingela

Description

@Mingela

Hello!

The case is following:

  • testcontainers-java 1.14.3
  • docker-compose.yml with services A, B, C
  • B depends on A
  • C depends on B and A
  • withLocalCompose(true)

A starts quite quickly, B start takes ~40 seconds
While B is unavailable C keeps restarting

  • Tried Wait.forLogMessage() for A - works
  • Tried Wait.forLogMessage() for B - works
  • Tried Wait.forLogMessage() for C - Timed out waiting for log output matching <log>
  • Tried Wait.forLogMessage() for both B and C - Timed out waiting for log output matching <log>

Actually I'm interested in waiting for both of the services B and C explicitly, but only C should be valid as well.

Tried all the possible regex stuff (.*log.*, .*log.*\\s, .*log!\\s, .*log.*\n.* etc)

From my impression it seems that log polling breaks for a restarting container.
The difference between B and C here is that when starting B does not encounter broken B->A interaction since A could easily be started for the time of starting B. Hence B does not get restarted 'on error'.

As I got from debugging

OutputFrame frame = frames.pollLast(100, TimeUnit.MILLISECONDS);

becomes null when the container is going to start successfully, it's really strange. It contains lines from a stacktrace when the container is going to be restarted and null when it's running :suspect:

Any ideas? Thanks.

p.s. of course I see the desired log of the C in my terminal using docker logs C

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions