title: Integration tests for continuous delivery using docker
body: <p>I currently develop a product which expose a a REST API and that will eventually be hosted on the cloud.</p>
  
  <p>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. </p>
  
  <p>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 : </p>
  
  <ul>
  <li>compile </li>
  <li>run unit tests</li>
  <li>build the application (jar) and deploy to a central repository </li>
  <li>create a docker container using this archive </li>
  <li>start the container (using spring boot) </li>
  <li>run integration tests against the running container </li>
  <li>run performance tests </li>
  <li>if everything is fine, deploy this container to a central repository </li>
  <li>deploy this same container to prod (just using different command line arguments). </li>
  </ul>
  
  <p>The upside of this approach is having the same container form integration test phase to production, which seems ideal, wouldn't it? </p>
  
  <p>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? </p>
  
  <p>Has anyone tried such approach? Do I miss something here?</p>
  
  <p>Thanks in advance </p>