rmh78 / quarkus-testcontainers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quarkus - Integration Tests

(1) Background

This Quarkus project uses Testcontainers with the Docker Compose Module for setting up an integration-test environment which contains:

  • Postgres DB
  • Kafka Broker
  • Kafka Zookeeper
  • Quarkus application

I'm using Mavens integration-test and verify phase to run my integration-tests against the docker-compose environment started by testcontainers. The test-classes are normal JUnit5 tests without the Quarkus annotations @QuarkusTest and @NativeImageTest.

This mechanism addresses an integration-test scenario where all real world components (postgres, kafka, etc. but no mocks or H2 dbs) and the application itself are in place for being tested from outside via REST calls. Without the need to deploy the whole stuff to your target cloud environment.

(2) run locally

(2.1) run integration-tests in JVM mode

  1. Change inside docker-compose.yml the dockerfile property of the app service to Dockerfile.jvm and use the jvm command

  2. Maven verfiy

    mvn verify

(2.2) run integration-tests in native mode

  1. Change inside docker-compose.yml the dockerfile property of the app service to Dockerfile.native and use the native command

  2. Maven verfiy

    mvn verify -Pnative

(3) run on Jenkins

mvn verify can be used at any CI build-pipeline too.

(4) other stuff

About

License:MIT License


Languages

Language:Java 41.1%Language:HTML 30.4%Language:Shell 28.5%