Closed jaads closed 1 day ago
Hi @jaads š
Please, check a little bit different issue, but it should help you since there is common ground between them: https://github.com/testcontainers/testcontainers-rs/issues/752
Specifically my responses there
Hi @DDtKey. I have tried using the ready-to-use postgres module, but I encountered the same issue unfortunately :/
Looks like the container is dropped before even attempt to connect:
start_database
returns u16
=> Container is dropped almost immediately after start
Take a look at the documentation about usage
ohh that was indeed the problem. my bad!! thanks so much @DDtKey!
I now get { code: 54, kind: ConnectionReset, message: "Connection reset by peer" }
though. I don't think I can use the ready-to-use postgres container because I also need to have postgis installed. Is there a workaround for this issue? I guess it's the same as https://github.com/testcontainers/testcontainers-rs/issues/752
Generally speaking - yes, you can apply the same patch for your implementation as we did for postgres prepared module.
But actually, you still should be able to use ready one, but customize the image with ImageExt - see examples in the documentation
I wasn't able to fix it myself, so I used the ready so use module for now. But at some point I'd need to use this image. since there is no ready to use module for this image, will the fix be applied for GenericImage as well?
As I mentioned above, you can use ImageExt
for existing postgres module to override the image reference. See with_name method documentation
It's only postgres specific, and there is nothing to do with generic one. It's just additional WaitFor required (actual fix was only this PR)
alright, I have it now using with_name
ā
thanks so much!! š
For my tests I currently have to start the docker container manually. I want to change that by using
testcontainers-rs
. I created the container like it's stated in the docs, with the same configuration as it is in my docker compose file. But I cannot connect to it. Due to my PG client (sqlx) isand this although when starting the container from the docker compose file, it worked fine. I tried other clients, but no one is working.
Here is my initial container configuration from docker compose:
I can connect to it without any problems. But when I start the same thing with
testcontainer-rs
, I cannot connect anymore. This is how I converted it:The container starts successfully and the functions returns the port. Here how I'm trying to connect to it:
But it does not connect. It panics with the above error message (connection refused). What I am missing?