You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect that test containers would log error when I use withWaitStrategy with not existing container name
OR
that the documentation highlights where should I serviceName vs containerName explaining difference between those two to avoid confusion and related issues.
Actual Behaviour
Testcontainers 'silently fails' to override the wait for strategy for given container, causing the startup to fail.
const environment = await new ('./', 'docker-compose.yml')
.withBuild()
.withWaitStrategy('mockServer', Wait.forLogMessage(/.+started on port.+/))
.up(['mockServer']);
Observe error
Error: Port 1080 not bound after 60000ms
Notes:
The documentation under https://node.testcontainers.org/features/compose/ uses exactly the same value for service name and container name (both using suffix -1) instead of highlighting that those are different things. As a result users might use the same value in their code, which might lead to confusing results. It appears as if the user is not able to override the default strategy of waiting until port is bound - no error saying that the container with given name does not exist, but error about port not being bound.
Switching the code to use withWaitStrategy('mockServer-1', Wait.forLogMessage(/.+started on port.+/)) fixes the issue.
On the other hand, changing the code to use .up(['mockServer-1']) results in error no such service: mockServer-1.
Thus, couple of improvements that could be considered:
Log error/warning if a wait strategy was assigned to a container that does not exist, e.g. no such container: mockServer.
Update the documentation to highlight difference between service name and container name
Switch the API to only allow use either service name and container name
Environment Information
Operating System: MacOS 14.2
Docker Version: 27.2.0
Node version: 20.11.0
Testcontainers version: 10.13.1
The text was updated successfully, but these errors were encountered:
Expected Behaviour
I would expect that test containers would log error when I use
withWaitStrategy
with not existing container nameOR
that the documentation highlights where should I serviceName vs containerName explaining difference between those two to avoid confusion and related issues.
Actual Behaviour
Testcontainers 'silently fails' to override the wait for strategy for given container, causing the startup to fail.
Testcontainer Logs
N/A
Steps to Reproduce
Notes:
The documentation under https://node.testcontainers.org/features/compose/ uses exactly the same value for service name and container name (both using suffix
-1
) instead of highlighting that those are different things. As a result users might use the same value in their code, which might lead to confusing results. It appears as if the user is not able to override the default strategy of waiting until port is bound - no error saying that the container with given name does not exist, but error about port not being bound.Switching the code to use
withWaitStrategy('mockServer-1', Wait.forLogMessage(/.+started on port.+/))
fixes the issue.On the other hand, changing the code to use
.up(['mockServer-1'])
results in errorno such service: mockServer-1
.Thus, couple of improvements that could be considered:
no such container: mockServer
.Environment Information
The text was updated successfully, but these errors were encountered: