sqldb-postgresql-testing: add TestModule mixin that pins testcontainers Docker API to 1.46 #28
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/support#28
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
org.testcontainers:testcontainers:1.20.x(and 1.21.x) hard-codes a fallback to Docker API 1.32 inDockerClientProviderStrategy.getClientForConfig:```java
if (apiVersion == UNKNOWN_VERSION)
.withApiVersion(VERSION_1_32)
```
Docker engine 28+ rejects 1.32 as too old (minimum 1.44 since Docker 25, 29 keeps the same floor):
```
client version 1.32 is too old. Minimum supported API version is 1.44, please upgrade your client to a newer version
```
The shaded
DefaultDockerClientConfig.createDefaultConfigBuilder()readsapi.versionfrom system properties (viaoverrideDockerPropertiesWithSystemPropertieswalkingCONFIG_KEYS), so passing-Dapi.version=1.46to the test JVM lets testcontainers negotiate the right API at handshake time.Symptom
Any project depending on
iw-support-sqldb-postgresql-testingand running its itest suite against a developer machine with modern Docker hits this on everywhenDockerAvailableblock — silently degrading the suite to "skipped" because the testcontainer never starts.Reproduced on:
dimafeng::testcontainers-scala-postgresql::0.41.5)remote-signingACA-507 phase 3, where Phase 1's `PostgresCredentialRepositorySpec` was also silently skipped before being noticed.Proposed fix
Provide a
TestModulemixin trait insqldb-postgresql-testing(e.g.PostgreSQLTestcontainersTests) that downstream itests extend instead of plainTestModule. The mixin sets:```scala
trait PostgreSQLTestcontainersTests extends TestModule:
override def forkArgs = super.forkArgs() ++ Seq("-Dapi.version=1.46")
```
so every consumer inherits the API override automatically. (Same idea applies to
sqldb-mysql-testing.)Workaround in consumer projects
Until the mixin lands, downstream projects need to set this on every itest module:
```scala
override def forkArgs = super.forkArgs() ++ Seq("-Dapi.version=1.46")
```
remote-signing(ACA-507) carries this ininfrastructure.itest'sforkArgs.Notes
1.46was picked as a safe ceiling that Docker 25+ supports. Anything in[1.44, current]should work.VERSION_1_32fallback constant.Fixed in #29 by bumping testcontainers 1.20.4 → 1.21.4. The upstream backport (released 2025-12-15) removes the hard-coded
VERSION_1_32fallback, so the MillTestModulemixin /-Dapi.version=1.46workaround proposed here is no longer needed.Verified locally on Docker engine 29.1.3 (API 1.52, min 1.44):
sqldb-postgresql.testruns 50 tests across 7 specs,sqldb-mysql.testruns 10 tests, 0 ignored in both — silent-skip behavior is gone.See
project-management/issues/SUPP-28/analysis.mdfor the resolution block and historical investigation.