testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

Add host for sql waiter URL function.

Open a-urth opened this issue 5 years ago • 7 comments

Issue: In case container is started in docker which is not in localhost (ci environment with tests already running in container), mapped port is not enough to establish connection to a database.

Solution: Add host parameter for url function, which is part of wait.ForSQL strategy, so it will be possible to construct connection url with docker host and mapped port.

a-urth avatar Mar 06 '20 10:03 a-urth

Thanks @a-urth This is a BC break but I actually like it. @mdelapenya what do yo think?

gianarb avatar Mar 06 '20 12:03 gianarb

Hey @gianarb is there any progress for this PR? Is it going to be merged?

a-urth avatar Apr 30 '20 08:04 a-urth

this is way easier to merge if we can figure out a way to avoid a bc-break. I think we can using the a with function. Like a WithHost(string). wdyt @a-urth ?

gianarb avatar Jun 16 '20 08:06 gianarb

this is way easier to merge if we can figure out a way to avoid a bc-break. I think we can using the a with function. Like a WithHost(string). wdyt @a-urth ?

Yes, I like the idea of not forcing a breaking change too

👍

mdelapenya avatar Aug 14 '20 11:08 mdelapenya

I'd waitForMerge("#214") </joke> before merging this.

wdyt?

mdelapenya avatar Aug 14 '20 12:08 mdelapenya

Hey guys, sorry to bring this back from the dead, but I was running into a similar situation. I'd love to get this merged so I can avoid having to revert to what testcontainers-java is doing (waiting for log messages).

If we can change this PR to preserve backwards compatibility, can we merge? I'm willing to invest some time into this unless @a-urth wants to apply the suggested changes?

michielboekhoff avatar Mar 01 '21 16:03 michielboekhoff

I just took a little stab at a backward-compatible way in #310. The reason I didn't just create a With method is because the URL function itself is also exposed to the calling code. Changing the way it constructs the URL (i.e. changing the URL function to be an interface) might break BC.

michielboekhoff avatar Apr 13 '21 12:04 michielboekhoff

I'm closing this PR, as it's already been implemented in #524

Thanks!

mdelapenya avatar Oct 27 '22 06:10 mdelapenya