I currently develop a product which expose a a REST API and that will eventually be hosted on the cloud.
My technology stack is spring (boot, mvc, data, test, etc.) on top of maven. I have integration tests to test from my API connected to a test database.
To better test my product in a same environment as it will run in production, I would like to use a container to perform my integration testing. My goal would be to follow this continuous delivery workflow :
- compile
- run unit tests
- build the application (jar) and deploy to a central repository
- create a docker container using this archive
- start the container (using spring boot)
- run integration tests against the running container
- run performance tests
- if everything is fine, deploy this container to a central repository
- deploy this same container to prod (just using different command line arguments).
The upside of this approach is having the same container form integration test phase to production, which seems ideal, wouldn't it?
However I don't know how to do that using spring mvc tests that resides in my source package. How could I use mockmvc to do such thing? How can it be flexible enough to run integration tests in development also?
Has anyone tried such approach? Do I miss something here?
Thanks in advance