Search code examples
testingcontainersibm-clouddevops

Run Tests within Container through the Bluemix DevOps service


I am working on an application based on the bluemix container service. To deploy the application I use the IBM Bluemix DevOps service.

I would like to add a test stage before deployment. The problem is that my tests need to run within a docker container using the image built for the application. The application needs the image setup which contains libraries, database etc (libraries, scripts, etc).

However, the available "test" stage in the DevOps service does not seem to allow running tests within a docker container. I would like to run my tests with something like

if ic run --rm my_custom_image custom_test_script.sh

How could I do such a test run within the Bluemix DevOps service?


Solution

  • IDS doesn't include a place to run dedicated sub-containers, and the container service is really intended for longer running containers (i.e. -d daemon style). You could do it by setting up a persistent container there, then using cf ic cp to copy up the changed pieces (i.e. something specific to this run), then a cf ic exec -ti to force it to run there, perhaps?

    Or if you'd rather, perhaps break it into a couple pieces - make the test into a "deploy the test container" step, then the test step using that container (or getting the results therefrom), then a cleanup of that container.