testcontainers / testcontainers-node

Testcontainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.com
MIT License
1.87k stars 183 forks source link

Make Colima work out of the box #824

Closed alecmev closed 1 month ago

alecmev commented 1 month ago

Is there a reason why Wait.forListeningPorts isn't the default behavior? I'm not sure if I'm reading it right, but it seems like it is in testcontainers-go, which makes it "just work" (source):

As of Colima v0.4.0 it's recommended to set the active Docker context to use Colima. After the context is set Testcontainers for Go will automatically be configured to use Colima.

cristianrgreco commented 1 month ago

It is the default behaviour. See here for more info https://node.testcontainers.org/supported-container-runtimes/

alecmev commented 1 month ago

It is the default behaviour

Hmm, I could be misunderstanding something, but doesn't the page you link to contradict this?

... wait strategies such as waiting for a health check or a log message are insufficient when using Colima. You can use a composite wait strategy to additionally wait for a port to be bound, on top of an existing wait strategy.

cristianrgreco commented 1 month ago

Is there a reason why Wait.forListeningPorts isn't the default behavior

My answer was to this question.

Users are free to use whatever wait strategy they wish. What you quoted explains that there is a known issue with colima if you deviate from the listening ports wait strategy (which is the default wait strategy).

alecmev commented 1 month ago

Ah, I understand, thanks, I see it:

https://github.com/testcontainers/testcontainers-node/blob/055c02f074e079996a2ba5be409dd0f3c8646252/packages/testcontainers/src/generic-container/generic-container.ts#L48

Okay, then my question is, why is this overridable? Seems like most modules forget to add Wait.forListeningPorts when using a custom strategy.

alecmev commented 1 month ago

@cristianrgreco Friendly ping, just in case you missed this. I'm interested in getting to the bottom of this because I'd be willing to at least update all modules to include forListeningPorts in their wait strategies if this is an oversight.