| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #892 +/- ##
=======================================
Coverage 78.86% 78.86%
=======================================
Files 14 14
Lines 1221 1221
Branches 142 142
=======================================
Hits 963 963
Misses 216 216
Partials 42 42 ☔ View full report in Codecov by Sentry.
|
Sorry, something went wrong.
|
can we add a new extra? like a db (or more accurately, sql) extra? this is assuming we dont want to aim for complete removal. Even if we do that, i dont like the _connect method on the container - i think connecting is the business of 1) app code 2) sql waiting strategy - so all the db interface has to do is tell someone how to connect - and maybe this can just return the url? This second point is made further complicated by now you can only use this waiting strategy on container that have the interface implemented. i think maybe this waiting strategy can be parametrized - with information on how to build the url. this removes the need for the container to build its own url (finally). just a thought. |
Sorry, something went wrong.
|
Sorry, something went wrong.
|
New version is ready:
You can now say SqlConnectWaitStrategy is basically sqlalchemyConnectWaitStrategy 😂 but this can also be improved and made more generic. |
Sorry, something went wrong.
|
I like the new SqlConnectWaitStrategy a lot. Indirectly the _connect method paired with wait_container_is_ready did just that in many database modules. |
Sorry, something went wrong.
|
Make one more critical improvement, now wait_strategy is a param for the SqlContainer, this
|
Sorry, something went wrong.
|
@alexanderankin now using WaitStrategy._poll and with_transient_exceptions from your latest improvements. |
Sorry, something went wrong.
There was a problem hiding this comment.
Tried to migrate Postgres and CrateDB module and it's fairly easy, I left a few nitpicks that you might use as inspiration, otherwise LGTM and I'd merge.
Sorry, something went wrong.
There was a problem hiding this comment.
Overall clearly an improvement on the existing DbContainer. A few questions/ideas inline, many to clarify my own understanding of stuff.
Sorry, something went wrong.
| Raises: | ||
| NotImplementedError: Must be implemented by subclasses | ||
| """ | ||
| raise NotImplementedError("Subclasses must implement get_connection_url()") |
There was a problem hiding this comment.
Should this have a default implementation to just call _create_connection_url? The SimpleSqlContainer implements it in this way & this feels like a reasonable default. I suspect most users of this class would either duplicate the implementation, or call the private method anyway which I think we'd want to discourage.
Sorry, something went wrong.
There was a problem hiding this comment.
SimpleSqlContainer is just a test, are you sure this is the default for all SQL related implementations?
for example Postgres needs driver so its not the exact same, but an extended build using the baseline _create_connection_url which is great. I personally like the current design and believe/hope it allows for max flexibility in the future.
Sorry, something went wrong.
This reverts commit f613a61.
🤖 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>
Add a CrateDB module under testcontainers.community.cratedb, ported from testcontainers#888 onto the current src/ layout and refactored onto the generic DbContainer base (per testcontainers#892), following the PostgresContainer pattern. - CrateDBContainer extends core.generic.DbContainer; single-node command, HTTP (4200) wait strategy, crate:// SQLAlchemy connection URL - deprecation shim at testcontainers.cratedb - tests under tests/community/cratedb, docs, and the `cratedb` optional-dependency - sqlalchemy-cratedb added to the test dependency group Supersedes testcontainers#888. Co-authored-by: surister <surister98@gmail.com>
Add a CrateDB module under testcontainers.community.cratedb, ported from testcontainers#888 and built on the generic SqlContainer base reintroduced in testcontainers#892. - CrateDBContainer extends community.generic.sql.SqlContainer; single-node command, HTTP (4200) wait strategy so startup needs no DB client library, crate:// SQLAlchemy connection URL - deprecation shim at testcontainers.cratedb - tests under tests/community/cratedb, docs, mkdocs nav entry, and the `cratedb` optional-dependency (empty; sqlalchemy-cratedb is a test-group dep) Supersedes testcontainers#888. Co-authored-by: surister <surister98@gmail.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a CrateDB module under testcontainers.community.cratedb, ported from testcontainers#888 and built on the generic SqlContainer base reintroduced in testcontainers#892. - CrateDBContainer extends community.generic.sql.SqlContainer; single-node command, HTTP (4200) wait strategy so startup needs no DB client library, crate:// SQLAlchemy connection URL - deprecation shim at testcontainers.cratedb - tests under tests/community/cratedb, docs, mkdocs nav entry, and the `cratedb` optional-dependency (empty; sqlalchemy-cratedb is a test-group dep) Supersedes testcontainers#888. Co-authored-by: surister <surister98@gmail.com>
Add a CrateDB module under testcontainers.community.cratedb, ported from testcontainers#888 and built on the generic SqlContainer base reintroduced in testcontainers#892. - CrateDBContainer extends community.generic.sql.SqlContainer; single-node command, HTTP (4200) wait strategy so startup needs no DB client library, crate:// SQLAlchemy connection URL - deprecation shim at testcontainers.cratedb - tests under tests/community/cratedb, docs, mkdocs nav entry, and the `cratedb` optional-dependency (empty; sqlalchemy-cratedb is a test-group dep) Supersedes testcontainers#888. Co-authored-by: surister <surister98@gmail.com>
Add a CrateDB module under testcontainers.community.cratedb, ported from #888 and built on the generic SqlContainer base reintroduced in #892. - CrateDBContainer extends community.generic.sql.SqlContainer; single-node command, HTTP (4200) wait strategy so startup needs no DB client library, crate:// SQLAlchemy connection URL - deprecation shim at testcontainers.cratedb - tests under tests/community/cratedb, docs, mkdocs nav entry, and the `cratedb` optional-dependency (empty; sqlalchemy-cratedb is a test-group dep) Supersedes #888 --------- Co-authored-by: surister <surister98@gmail.com> Co-authored-by: Andreas Motl <andreas.motl@elmyra.de>
| Back | FazBrowse Home | New Git URL |
Related to #884
Trying to replace the old generic.py in core to a nicer version under the generic module.
SqlContainer its not as good (in being generic) as ServerContainer but it should allow us to deprecate core/testcontainers/core/generic.py with minimal effort for users, it could lead to a more Generic version like DBContainer in the future.
Update 1: Refactor to use SqlConnectWaitStrategy
Update 2: Now SqlConnectWaitStrategy is required and the users can provide SqlContainer with any wait strategy.
Update 3: Now utilizes all the latest improvements from WaitStrategy
Note: I think the added tests + documentation (provided in this PR) are by themselves a great improvement over the current generic.py