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

Make DockerCompose.get_service_info public

Open csikb opened this issue 2 years ago • 2 comments

I'm new to Python. I welcome every suggestion. :)

csikb avatar Aug 28 '22 20:08 csikb

Codecov Report

Merging #240 (d879694) into master (b65c8a0) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #240   +/-   ##
=======================================
  Coverage   86.05%   86.05%           
=======================================
  Files          27       27           
  Lines         746      746           
  Branches       70       70           
=======================================
  Hits          642      642           
  Misses         80       80           
  Partials       24       24           
Impacted Files Coverage Δ
testcontainers/compose.py 98.36% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Aug 28 '22 20:08 codecov-commenter

In the future it would make sense to depreciate the get_host and get_port methods in favour of this.

csikb avatar Aug 30 '22 15:08 csikb

hi @csikb unfortunately this module has changed and your PR doesn't land so neatly - feel free to reply to this issue if this API is not sufficient as it seems to be similar in intent: with DockerCompose() as d: d.get_container(service_name).get_publisher(by_port=port) API.

it returns this object which contains the URL and PublishedPort

https://github.com/testcontainers/testcontainers-python/blob/5bef18a51360a2d74ba393f86b753abdf9ec5636/core/testcontainers/compose/compose.py#L29-L38

unfortunately it doesn't quite work as expected on #457 (we normalize the host in the public API of the module), arguably we should normalize it "sooner"?

alexanderankin avatar Mar 09 '24 15:03 alexanderankin