Activiti: Replace docker-maven-plugin with Testcontainers

Created on 22 Feb 2018  路  7Comments  路  Source: Activiti/Activiti

I would like to be able to run integration tests within an IDE like IntelliJ and the fact we rely on the Maven integration-test phase make things quite cumbersome to do outside Maven.

An option in IntelliJ is to add a Maven Goal before launch which executes:

mvn io.fabric8:docker-maven-plugin:build@build io.fabric8:docker-maven-plugin:start@start

where build and start are the executions that build and start the docker images, but there is no way to stop it when the test ends.

A better option would be to do everything in code and move IT tests to a separate maven module which can be activated by an integration-test profile.

There are some projects providing standard JUnit Rules to integrate with Docker and Compose:

enhancement

Most helpful comment

@mteodori should you have any questions/issues, feel free to ping me - I (or other @testcontainers team members) will be happy to help 馃憤

All 7 comments

馃憤 to separate IT tests into separate modules, that will also benefit our build and release pipelines.
Not sure if I want to get rid of docker-maven-plugin, that does much more than we are using and we can use to hook our projects into pipelines that goes from source to a deployment in kubernetes.

Hi @mteodori @Salaboy,

I'm a remember of Testcontainers project and happy to help you / answer questions if you consider it :)

@Salaboy I would love to know what docker-maven-plugin could offer (for testing) over TC, probably we can align our features set? :)

Personally, I prefer to use TC-like frameworks instead of Maven/Gradle plugins to keep it possible to run the tests from IDE (and motivate users to run them, after all :D ).
This way you can debug, control the lifecycle of the containers imperatively, and we also have some nice features like:

  • containers cleanup, even if you kill -9 your tests / Maven / Gradle -> super important for CI
  • waiting strategies (not just "is port open?", but even JDBC-based SELECT 1 if needed)
  • Networks support - ever wondered what happens with the code when the connection to DB drops? Now it's testable :)
  • pre-configured, reusable containers. Sometimes it's not that easy to use different technologies inside a Container, i.e. Kafka doesn't work properly with random ports, and we use random ports to ensure that parallel tests will not break anything.

Just ping me here, email or in Slack ( http://slack.testcontainers.org/ ) if you need any help or clarification 馃檪

@bsideup sounds like a great idea. Let's try to collaborate.
originally the docker-maven-plugin offer a great flexibility in triggering maven goals related with creating docker images and even also deploying to kubernetes (creating deployments descriptors).
This makes a lot of sense when you plan to trigger a pipeline that takes your repo from source (java) to a container running in kubernetes wrapped by a service. Do you guys have any experience with kubernetes?
In any case I will join the slack channel .

I will down vote the idea of getting rid of the maven docker plugin from fabric8 because it does a lot of good things, but if we find better way to tests our containers we might setup our pipelines using those tools.

@Salaboy
I know a few projects where docker-maven-plugin is used for the deployment/image building and Testcontainers for testing.

We keep k8s, building and orchestrating out of a scope of Testcontainers to focus on integration testing scenarios, like:

  • Real MySQL/PostgreSQL/etc in containers (can be as simple as providing a special JDBC-url)
  • Kafka/Redis/RabbitMQ and other NoSQL databases
  • Selenium browsers (Chrome, Firefox, etc) for the browser testing

Since Activiti is a library/framework, you might want to look at how Testcontainers is used to test Zipkin, Spring Boot, Spring Data JDBC and other libraries and frameworks.
Usually it works the best to test integrations with different databases to simplify the process of testing for both contributors and CI :)

馃憤
That's exactly my point of view and looking at your gitbook it makes a lot of sense.

time to resurrect this issue and introduce testcontainers @bsideup hopefully we'll make it without too much effort

@mteodori should you have any questions/issues, feel free to ping me - I (or other @testcontainers team members) will be happy to help 馃憤

Was this page helpful?
0 / 5 - 0 ratings