Commit Graph

134 Commits

Author SHA1 Message Date
Phillip Webb
26566d4a30 Allow testcontainer beans to also contribute properties
Allow `Container` bean definitions to inject a `DynamicPropertyRegistry`
so that they can contribute environment properties.

Closes gh-35201
2023-05-03 00:27:13 -07:00
Phillip Webb
e9578fe745 Swallow BeanCurrentlyInCreationException exceptions
Update `TestcontainersLifecycleBeanPostProcessor` to that initialization
doesn't fail if a `BeanCurrentlyInCreationException` is thrown.

Prior to this commit, if the first bean being post-processed was a
configuration class declaring a bean that the `Container` depended on
all initialization would fail.

See gh-35223
2023-05-03 00:24:30 -07:00
Phillip Webb
3997771f6c Polish 2023-05-02 23:40:30 -07:00
Moritz Halbritter
2586150eaf Disable ARM incompatible integration tests 2023-05-02 14:59:49 +02:00
Andy Wilkinson
b1d0433d74 Handle Kafka servers as strings and rely on Kafka's parsing
Closes gh-34770
2023-05-02 08:38:40 +01:00
Phillip Webb
dc4efaf276 Initialize containers first and destroy them last
Update `TestcontainersLifecycleBeanPostProcessor` so that on
initialization of the first bean all `Container` instances are started.

With this update all `Container` beans will be started first in the
`preInstantiateSingletons` phase and destroyed last.

Closes gh-35223
2023-05-01 23:59:22 -07:00
Phillip Webb
14bc354f7f Apply initializer automatically for context tests
Update `ServiceConnectionContextCustomizer` so that is applies the
`TestcontainersLifecycleApplicationContextInitializer` to all
application contexts.

Closes gh-35222
2023-05-01 23:59:22 -07:00
Phillip Webb
632c5d7ea5 Implement ServiceConnectionContextCustomizer equals and hashcode for key
Update `ServiceConnectionContextCustomizer` with `equals` and `hashcode`
methods so that it works correctly when part of a context cache key.

Closes gh-35216
2023-05-01 23:59:22 -07:00
Phillip Webb
25e3291d86 Broaden exceptions that include ServiceConnection name hint
See gh-35168
2023-05-01 22:13:50 -07:00
Phillip Webb
b4cd2572d5 Prevent early initialization of Container beans
Update testcontainers auto-configuration so that `Container` bean
instances are no longer needed when registering `ConnectionDetails`
beans. Registration now occurs based on the bean type and the `name`
attribute of `@ServiceConnection`.

Fixes gh-35168
2023-05-01 00:21:47 -07:00
Phillip Webb
c21cf31853 Switch order of ContainerConnectionDetailsFactory generics
Switch `ContainerConnectionDetailsFactory` so that `Container`
is before `ConnectionDetails`.
2023-05-01 00:00:43 -07:00
Phillip Webb
fc5339f81c Polish 2023-04-30 23:27:06 -07:00
Phillip Webb
c13041201d Don't call close methods for reusable testcontainers
Refine `TestcontainersLifecycleApplicationContextInitializer` so that
the `close()` method is not called for reusable containers.

Closes gh-35210
2023-04-30 06:07:05 -07:00
Phillip Webb
e7357ba805 Increase timeout in OracleR2dbcContainerConnectionDetailsFactoryTests 2023-04-29 21:10:19 -07:00
Phillip Webb
d1084ee6db Refactor ContainerConnectionDetailsFactory classes
Update `ContainerConnectionDetailsFactory` so that they consistently
extend `ContainerConnectionDetails`. The container is also no longer
accessible from the `ContainerConnectionSource` and is never used
during the construction of `ConnectionDetails` instances.

See gh-35168
2023-04-29 21:10:14 -07:00
Phillip Webb
403481ff96 Add 'required' parameter to ConnectionDetailsFactories
Update `ConnectionDetailsFactories` so that callers can now declare if
a result is required or not and improve exception hierarchy.

See gh-35168
2023-04-29 21:10:07 -07:00
Andy Wilkinson
cec159110d Do not block indefinitely when querying SQL database 2023-04-28 09:52:27 +01:00
Andy Wilkinson
d7da77bda8 Remove support for service connections to InfluxDB
Closes gh-35189
2023-04-28 09:49:39 +01:00
Andy Wilkinson
5e73047164 Align SQL Server-related class names with existing precedents
Closes gh-35181
2023-04-27 10:33:25 +01:00
Yanming Zhou
b615aef810 Fix dependency management for spring-boot-testcontainers
This commit adds org.testcontainers:testcontainers as an api dependency
of spring-boot-testcontainers so that GenericContainer can be used
without an additional dependency

See gh-35119
2023-04-25 10:04:52 +02:00
Stephane Nicoll
facf48e423 Polish "Prevent container to be closed twice"
See gh-35120
2023-04-25 09:59:52 +02:00
Yanming Zhou
5df6913f18 Prevent container to be closed twice
See gh-35120
2023-04-25 09:59:52 +02:00
Andy Wilkinson
e61adc6cbf Allow even more time for Redpanda to start 2023-04-20 17:41:40 +01:00
Andy Wilkinson
5ec03d2b34 Wait longer for Redpanda to start 2023-04-18 21:43:25 +01:00
Andy Wilkinson
0da209db08 Polish "Add support for Oracle R2DBC Service Connection"
See gh-34852
2023-04-18 13:47:46 +01:00
Eddu Melendez
6d893b2fe2 Add support for Oracle R2DBC Service Connection
See gh-34852
2023-04-18 12:53:05 +01:00
Eddu Melendez
f4bcf99d30 Add service connection from Testcontainers Redpanda
Redpanda (https://redpanda.com/) is Kafka-compatible and
Testcontainers provides a module. This commit adds support for
creating KafkaConnectionDetails from a
@ServiceConnection-annotated RedpandaContainer.

See gh-34780
2023-04-18 12:49:25 +01:00
Andy Wilkinson
7b3e3deb58 Remove unused generic from ContainerConnectionSource
See gh-35017
2023-04-17 17:11:08 +01:00
Stephane Nicoll
7cf28680c9 Polish 2023-04-17 14:28:35 +02:00
Stephane Nicoll
95f07484a8 Add missing check on Docker availability 2023-04-17 14:28:11 +02:00
Phillip Webb
5ac48f5f15 Add testcontainers service connection auto-configuration
Add auto-configuration for `Container` beans that are also
annotated with `@ServiceConnection`. This commit allow
testcontainers to be used at development time and a new section
has been added to the documentation to describe the feature.

Closes gh-35022
2023-04-17 00:49:43 -07:00
Phillip Webb
3b92173a66 Add Testcontainer bean lifecycle support
Add `TestcontainersLifecycleApplicationContextInitializer` and
`TestcontainersLifecycleBeanPostProcessor` to take care of starting and
stopping `Container` beans.

Closes gh-35021
2023-04-17 00:48:20 -07:00
Phillip Webb
81a972af8d Refactor testcontainers service connections
Update restcontainers service connections support so that
technology specific `@ServiceConnector` annotations are not longer
required.

A single `@ServiceConnector` annotation can now be used to create
all `ConnectionDetail` beans.

Closes gh-35017
2023-04-17 00:45:39 -07:00
Phillip Webb
11dac5b5b7 Create dedicated spring-boot-testcontainers module
Create a dedicated testcontainers module containing the service
connectors code.

Closes gh-34757
2023-04-17 00:42:31 -07:00