arquillian / arquillian-cube

Control (docker, kubernetes, openshift) containers in your tests with ease!
http://arquillian.org/arquillian-cube/
121 stars 98 forks source link

CubeController.create() does not pull the image if it's not present #547

Closed jamesnetherton closed 7 years ago

jamesnetherton commented 7 years ago
Issue Overview

When attempting to use CubeController.create(), if the image is not present then the operation fails.

Maybe this is the expected (or even desired?) behaviour. But having to manually pre-pull stuff is kinda painful, especially in CI scenario.

Expected Behaviour

CubeController.create() pulls the image if it's not present.

Current Behaviour

An exception is thrown:

2017-01-11 15:21:22 WARN  [org.apache.cxf.phase.PhaseInterceptorChain] (main) - Interceptor for {http://localhost:2375/containers/create}WebClient has thrown exception, unwinding now
com.github.dockerjava.api.exception.NotFoundException: {"message":"No such image: influxdb:1.1"}
Steps To Reproduce
  1. Define an image spec like:
<property name="autoStartContainers">[none]</property>
<property name="definitionFormat">CUBE</property>
<property name="dockerContainers">
    InfluxDB:
        image: influxdb:1.1
</property>
  1. Inject CubeController into a test and attempt to create an influxdb container:
public class InfluxDBTest {

    @ArquillianResource
    CubeController cubeController;

    public static JavaArchive createDeployment() {
        return ShrinkWrap.create(JavaArchive.class, "influxdb-tests.jar");
    }

    @Test
    public void testInfluxDB() throws Exception {
        try {
             cubeController.create("InfluxDB")
             // Do some InfluxDB testing
        } finally {
             cubeController.destroy("InfluxDB")
        }
    }
}
lordofthejars commented 7 years ago

It is not easy to provide this in the sense that for Docker the operations are create, start and pull not createAndStartAndPullIfNecessary and we are trying to be Docker compliant in this sense, but maybe we could provide any helper or something but not clear idea right now. cc/ @bartoszmajsak

lordofthejars commented 7 years ago

The strange thing is that after reviewing the code it seems it should work @jamesnetherton can you share the project so it can be debugged?

jamesnetherton commented 7 years ago

You're right. This does actually work fine so I'll close this issue.

I think the thing that is screwing this up for me is that I have CXF dependencies present on the classpath. These conflict with the docker java client and the jersey stuff. Thus I get unpredictable behaviour.

lordofthejars commented 7 years ago

Nice to hear that, this is something that we are working with @bartoszmajsak to change from docker-client to fabric8-docker so we don't have JAXRS classpath problems.