jeudi 19 novembre 2020

Is it possible to use Testcontainers on Spring (non Boot)?

I am designing integration tests on kinda legacy app and I am facing the problem I have a services I´d like to use only for one run of Integration tests.

The app contains a multiple modules, 4 spring (non boot) applications and these are using these services:

  • PostgreSQL database
  • RabiitMQ instance
  • ElasticSearch instance

Whole stack is currently dockerized via docker-compose (so using docker-compose up the whole app starts, database schemas are created etc).

I would like to achieve this via testcontainers. So start PostgreSQL container where I run flyway scripts to create schema and full database with data required to run (other data will be added in separate tests), then start RabbitMQ and then ElasticSearch instance.

All these automatically every time integration test run.

Is this even possible using "legacy" Spring (non Boot)? And is this possible to automatize process that it could run many times on one server (so there wont be any port collisions). The goal is to run this on sobe Git repository after merge request was submitted to check if all integration tests pass.

Thank you for advices.

Aucun commentaire:

Enregistrer un commentaire