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

Add waitForSqlWithHost implementation.

Open michielboekhoff opened this issue 4 years ago • 3 comments

This implementation mostly copies the prior waitForSql implementation, the difference being that the waitForSqlWithHost allows the user to construct a connection string using the host of the DB container. This is especially useful in a scenario like CI (where tests are being executed in a container) or even remote Docker hosts.

To preserve backwards compatibility, and because of the way that waitForSql works, waitForSqlWithHost replicates the existing behaviour mostly. In a v1 of testcontainers-go, you would probably want to unify these two differing implementations.

One thing I would like to (personally) see in a v1 of testcontainers-go is that the underlying strategy struct is not exposed to the calling code (instead opting to return the Strategy interface) so that we can change its implementation, whereas right now we cannot, as all the fields are exposed to calling code.

michielboekhoff avatar Apr 13 '21 11:04 michielboekhoff

Codecov Report

Merging #310 (ec477cb) into main (b5ff9a2) will decrease coverage by 2.24%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #310      +/-   ##
==========================================
- Coverage   69.79%   67.55%   -2.25%     
==========================================
  Files          21       21              
  Lines        1947     2000      +53     
==========================================
- Hits         1359     1351       -8     
- Misses        472      530      +58     
- Partials      116      119       +3     
Impacted Files Coverage Δ
wait/sql.go 11.88% <0.00%> (-13.12%) :arrow_down:
docker.go 69.63% <0.00%> (-0.93%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b5ff9a2...ec477cb. Read the comment docs.

codecov[bot] avatar Apr 13 '21 11:04 codecov[bot]

Also, we might want to wait for #214 to be merged in before we look at this.

michielboekhoff avatar Apr 13 '21 12:04 michielboekhoff

@gianarb - might be great to get your feedback on this if you get a chance!

michielboekhoff avatar Apr 24 '21 10:04 michielboekhoff

@michielboekhoff I think this PR has been superseded by #524

Please let me know if I can close it, as its original intention has been already implemented and merged into main (not released yet)

mdelapenya avatar Oct 03 '22 11:10 mdelapenya

@michielboekhoff I think this PR has been superseded by #524

Please let me know if I can close it, as its original intention has been already implemented and merged into main (not released yet)

Yep, seems like it. I've closed this PR.

michielboekhoff avatar Oct 03 '22 11:10 michielboekhoff