1.12.0
版本发布时间: 2019-07-24 16:27:00
testcontainers/testcontainers-java最新发布版本:1.20.2(2024-10-01 06:18:31)
What's Changed
🚀 Features
-
Add DB2 module (#1611) @aguibert
As a result of our collaboration with @aguibert and @irinadel from IBM, we're happy to bring DB2 support to Testcontainers 🎉 It of course works with the JDBC URL support too! It means you can spin up a real instance of DB2 in your tests with one line:
jdbc:tc:db2:///databasename
.
For more info, check the module's page: https://www.testcontainers.org/modules/databases/db2/ -
Implement
dependsOn
for cross-container dependencies (#1404) @bsideupEver wanted to wait for container B before starting container A? We got you covered 😎
With the new
dependsOn
method, it is now possible to model a graph of dependencies between your containers:@Rule KafkaContainer kafka = new KafkaContainer(); @Rule SchemaRegistryContainer schemaRegistryContainer = new SchemaRegistryContainer("5.2.1") .withKafka(kafka) .dependsOn(kafka);
-
Improve pull handling (#1320) @rnorth
Pulling images is sometimes a long running process. And, as with every long running process, having some sort of a visualization could help understanding what is going on!
Before:
11:15:50.598 INFO 🐳 [ibmcom/db2express-c:latest] - Pulling docker image: ibmcom/db2express-c:latest. Please be patient; this may take some time but only needs to be done once.
Oh yeah, it will take some time 😅
After:
19:34:25.198 INFO 🐳 [ibmcom/db2express-c:latest] - Pulling image 19:34:25.198 INFO 🐳 [ibmcom/db2express-c:latest] - Pulling image layers: 0 pending, 0 downloaded, 0 extracted, (0 bytes/0 bytes) 19:34:25.967 INFO 🐳 [ibmcom/db2express-c:latest] - Pulling image layers: 12 pending, 1 downloaded, 0 extracted, (32 bytes/? MB) 19:34:27.363 INFO 🐳 [ibmcom/db2express-c:latest] - Pulling image layers: 11 pending, 2 downloaded, 0 extracted, (1 MB/? MB) 19:34:58.519 ERROR 🐳 [ibmcom/db2express-c:latest] - Docker image pull has not made progress in 30s - aborting pull 19:34:58.564 ERROR 🐳 [ibmcom/db2express-c:latest] - Failed to pull image: ibmcom/db2express-c:latest. Please check output of `docker pull ibmcom/db2express-c:latest`
(Note that it detected a problem with pulling and reported it, hinting you how to debug it!)
-
Add RabbitMQ module (#1449) @martingreber
Hey, 🐰 fans! How flexible do you think RabbitMQ can be? That flexible:
RabbitMQContainer container = new RabbitMQContainer() .withVhost("vhost1") .withVhostLimit("vhost1", "max-connections", 1) .withVhost("vhost2", true) .withExchange("direct-exchange", "direct") .withExchange("topic-exchange", "topic") .withQueue("queue1") .withQueue("queue2", true, false, ImmutableMap.of("x-message-ttl", 1000)) .withBinding("direct-exchange", "queue1") .withUser("user1", "password1") .withUser("user2", "password2", ImmutableSet.of("administrator")) .withPermission("vhost1", "user1", ".*", ".*", ".*") .withPolicy("max length policy", "^dog", ImmutableMap.of("max-length", 1), 1, "queues") .withPolicy("alternate exchange policy", "^direct-exchange", ImmutableMap.of("alternate-exchange", "amq.direct")) .withOperatorPolicy("operator policy 1", "^queue1", ImmutableMap.of("message-ttl", 1000), 1, "queues") .withPluginsEnabled("rabbitmq_shovel", "rabbitmq_random_exchange");
-
Allow JUnit Jupiter tests to be disabled when Docker is unavailable (#1530) @wilkinsona
Thanks to our friends from Spring Boot (who also happened to use Testcontainers a lot 😁), it is now possible to skip JUnit Platform-based tests if Docker is not available:
@Testcontainers(disabledWithoutDocker = true) class SomeIntegrationTest { // ... }
-
Fail fast if
container_name
is set in Docker Compose file (#1581) @bsideupTestcontainers does not support
container_name
property because it breaks the service discovery, but, before this change, the tests were failing without pointing to the problem.
Thanks to the initial work from @mumukiller, it will fail fast if the property is presented. -
Add new
withDockerfile
methods toImageFromDockerfile
(#1535) @aguibertImageFromDockerfile
should respect the.dockerignore
file from now on. -
Enable command override for PostgreSQLContainer (#938) @kellen
-
Add container stopping and stopped hooks (#1610) @jalaziz
-
Fail gracefully if no JDBC driver found (#1434) @rnorth
-
Simplify Kafka container by deferring the Kafka command (#1458) @bsideup
🧹 Housekeeping
-
Azure Pipelines for Windows testing (#1363) @bsideup
This one is not a feature, but an exciting change! We now test every master build (and some PRs) on Windows!
Since it requires running a real Windows machine, we have to host it ourselves.
P.S. consider contacting us if you have a few spare Windows nodes ;)
🐛 Bug Fixes
- Improve splitting of SQL scripts into statements (#1627) @rnorth
- catch exception when trying to kill dead container (#1420) @chungngoops
📖 Documentation
- Kotlin example (#1521) @eaxdev
- Module contribution policy (#1576) @rnorth
📦 Dependency updates
- Upgrade duct-tape library (#1433) @rnorth
- Upgrade localstack and enable new services (#1504) @rnorth
- Bumped up default version of Confluent Platform to the current 5.2.1 (Kafka container) (#1446) @wlsc
- Bump docker-java from 3.1.0-rc-4 to 3.1.5 in /core (#1649) @dependabot-preview @bsideup
- Bump mysql-connector-java from 8.0.16 to 8.0.17 in /modules/mysql (#1633) @dependabot-preview
- Bump aws-java-sdk-sqs from 1.11.594 to 1.11.597 in /modules/localstack (#1654) @dependabot-preview
- Bump junit-jupiter-api from 5.5.0 to 5.5.1 in /modules/junit-jupiter (#1638) @dependabot-preview
- Bump junit-jupiter-engine from 5.5.0 to 5.5.1 in /modules/junit-jupiter (#1642) @dependabot-preview
- Bump neo4j from 3.5.7 to 3.5.8 in /modules/neo4j (#1640) @dependabot-preview
- Bump amqp-client from 5.7.1 to 5.7.2 in /core (#1588) @dependabot-preview
- Bump cucumber-junit from 4.5.4 to 4.6.0 in /examples (#1619) @dependabot-preview
- Bump cucumber-java from 4.5.4 to 4.6.0 in /examples (#1620) @dependabot-preview
- Bump aws-java-sdk-sqs from 1.11.479 to 1.11.594 in /modules/localstack (#1626) @dependabot-preview
- Bump cucumber-java from 4.5.1 to 4.5.4 in /examples (#1615) @dependabot-preview
- Bump cucumber-junit from 4.5.1 to 4.5.4 in /examples (#1614) @dependabot-preview
- Bump tomcat-jdbc from 9.0.21 to 9.0.22 in /modules/mysql (#1599) @dependabot-preview
- Bump tomcat-jdbc from 9.0.21 to 9.0.22 in /modules/mariadb (#1600) @dependabot-preview