Skip to content

fix(generic): Migrate ServerContainer from deprecated decorator to HttpWaitStrategy - #971

Merged
alexanderankin merged 3 commits into
testcontainers:mainfrom
jmillxyz:fix/generic-server-wait-strategy
Apr 1, 2026
Merged

fix(generic): Migrate ServerContainer from deprecated decorator to HttpWaitStrategy#971
alexanderankin merged 3 commits into
testcontainers:mainfrom
jmillxyz:fix/generic-server-wait-strategy

Conversation

@jmillxyz

Copy link
Copy Markdown
Contributor

Hi there, I've seen this deprecation warning in a generic container. This is my first PR in this project; I'm open to any feedback you may have!

Related: #874

Also updates the docs, highlighted in this comment

@Tranquility2

Copy link
Copy Markdown
Contributor

Hi @jmillxyz thanks for the contribution, can you please rebase and I'll take a look?

@Tranquility2Tranquility2 changed the title Migrate ServerContainer from deprecated decorator to HttpWaitStrategyfix: Migrate ServerContainer from deprecated decorator to HttpWaitStrategyApr 1, 2026
@Tranquility2Tranquility2 changed the title fix: Migrate ServerContainer from deprecated decorator to HttpWaitStrategyfix(generic): Migrate ServerContainer from deprecated decorator to HttpWaitStrategyApr 1, 2026
@codecov

codecovBot commented Apr 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.54%. Comparing base (898faf6) to head (a36524f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #971 +/- ##
=======================================
Coverage 79.54% 79.54% =======================================
Files 15 15 Lines 1281 1281 Branches 151 151 =======================================
Hits 1019 1019 Misses 218 218 Partials 44 44 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tranquility2
Tranquility2 self-requested a review April 1, 2026 15:05
@wait_container_is_ready(HTTPError, URLError)
def _connect(self) -> None:
# noinspection HttpUrlsUsage
url = self._create_connection_url()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure skipping the _create_connection_url is a good idea

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmillxyz wdyt?

@Tranquility2Tranquility2Apr 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice it has some logic

def_create_connection_url(self) ->str:
ifself._containerisNone:
raiseContainerStartException("container has not been started")
host=self.get_container_host_ip()
exposed_port=self.get_exposed_port(self.internal_port)
url=f"http://{host}:{exposed_port}"returnurl

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Tranquility2, this makes sense and thanks for your help :)

@Tranquility2
Tranquility2 self-requested a review April 1, 2026 15:38
@alexanderankin
alexanderankin merged commit 460b0d8 into testcontainers:mainApr 1, 2026
12 checks passed
alexanderankin added a commit that referenced this pull request Apr 7, 2026
🤖 I have created a release *beep* *boop*
---
##
[4.15.0-rc.1](testcontainers-v4.14.2...testcontainers-v4.15.0-rc.1)
(2026-04-07)
### Features
* **compose:** add structured container inspect information
([#897](#897))
([58459a1](58459a1))
* **core:** support SSH-based DOCKER_HOST
([#993](#993))
([d48115d](d48115d))
* **generic:** Reintroducing the generic SQL module
([#892](#892))
([2ca2321](2ca2321))
* **keycloak:** support for relative path and management relative path
([#982](#982))
([898faf6](898faf6))
* **mqtt:** MosquittoContainer: Add version 2.1.2
([#978](#978))
([af382f7](af382f7))
### Bug Fixes
* **azurite:** make visible to type checkers
([#927](#927))
([baa5668](baa5668))
* **clickhouse:** add `HttpWaitStrategy` instead of deprecated
`wait_container_is_ready`
([#962](#962))
([8034541](8034541))
* **compose:** return type in get_service_port docstring
([#939](#939))
([fed65fe](fed65fe))
* **core:** Refactor copy file
([#996](#996))
([0e0bb24](0e0bb24))
* **core:** wait for ryuk more reliably, improve tests: long_running,
filter logs
([#984](#984))
([b12ae13](b12ae13))
* **generic:** Migrate ServerContainer from deprecated decorator to
HttpWaitStrategy
([#971](#971))
([460b0d8](460b0d8))
* **kafka:** Use wait strategy instead of deprecated wait_for_logs
([#903](#903))
([87332c1](87332c1))
* **postgres:** add py.typed marker to postgres module
([#849](#849))
([c8a5bbd](c8a5bbd))
* **qdrant:** migrate Qdrant from deprecated decorator.
([#963](#963))
([407f798](407f798))
* **redis:** Use wait strategy instead of deprecated decorator
([#914](#914))
([e25713a](e25713a))
* **sftp:** Avoid using wait_for_logs in module.
([#995](#995))
([83157eb](83157eb))
---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Co-authored-by: David Ankin <daveankin@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jmillxyz@Tranquility2@ambitda@alexanderankin