Integration tests
Integration tests use Testcontainers. Test containers are available for:
- PostgreSQL
- MongoDB
- Neo4j
- the search engine
- Keycloak
Quarkus supports Testcontainers natively. When a test uses a database or a service, Quarkus detects it from the configuration and starts the matching container automatically.
What a run looks like
In this run, MongoDB and Keycloak start as containers, while Neo4j is taken from a local installation:
[DockerClientFactory] Docker host IP address is localhost
[DockerClientFactory] Connected to docker:
Server Version: 27.1.2
API Version: 1.46
[KeycloakDevServicesProcessor] Using Quarkus powered Keycloak distribution
Creating container for image: quay.io/keycloak/keycloak:23.0.7
Creating container for image: docker.io/mongo:4.4
[io.qua.neo.deployment] Not starting Dev Services for Neo4j, as the default config points to a reachable address. Be aware that your local database will be used.
Container docker.io/mongo:4.4 started in PT2.354415554S
Container quay.io/keycloak/keycloak:23.0.7 started in PT24.49291157S
[KeycloakDevServicesProcessor] Dev Services for Keycloak started.
Neo4j
The Neo4j connection is managed by the Quarkus Neo4j extension. It does not start a test container when something already answers the Bolt protocol on port 7687: the local database is used instead.
Configuring the test containers
Test containers are enabled by the settings in application.properties or
application-test.properties, or by the profile set with @TestProfile.
They can also be started by hand with the test helper:
private static final TestHelper test = TestHelper.helper();