Arquillian Cube Extension 1.0.0.Alpha1 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

The Arquillian team is proud to announce the 1.0.0.Alpha1 release of the Arquillian Cube Extension component!

Have a little control freak inside? Need to control it all?

Resistance is futile, all bugs will be assimilated!

What is Arquillian Cube?

With Arquillian Cube you can control the lifecycle of Docker images as part of the test lifecyle, either automatically or manually.

This gives you the chance to scale up from a integration/functional test level all the way up to the system test level.

It’s was named Cube simply because:

  • Docker is like a cube
  • The Borg starship is named a cube and because we are moving tests close to production we can say that “resistance is futile, all bugs will be assimilated”.

How does it work?

Arquillian Cube communicates with the Docker server via its remote REST API. You can build/create/start/stop/remove Docker instances with all the normal Docker features you’re used to.

Arquillian Cube Docker currently require the Docker server to run with TCP communication enabled. Read the preliminaries for detail information on how to set it up. Unix Socket support will be added in a later version.

What’s included in the Alpha1 release?

Pulling images from custom repository
Extendable configuration
Building images as part of test lifecycle
Integration with Arquillian Container

Details

Pulling images

By default, when you refer to a Docker image by it’s id, Cube will use the official registry.hub.docker.com registry to look for images.

If you’re running your own Docker registry, either locally or remote, you can reconfigure Cube to use that one instead via the dockerRegistry configuration option.

<extension qualifier="docker">
    <property name="dockerRegistry">http://my-internal-registry.company.com</property>
</extension>

Cube Configuration

You can configure the individual Cubes in two different ways.

Either you can include a yaml snippet in the arquillian.xml configuration element dockerContainers;

<extension qualifier="docker">
    <property name="dockerContainers">
       tomcat:
         image: tutum/tomcat:7.0
         exposedPorts: [8089/tcp]
       portBindings:
         - exposedPort: 8089/tcp
           port: 8089
    </property>
</extension>

Or you can refer to an external file via dockerContainersFile.

<extension qualifier="docker">
    <property name="dockerContainersFile">src/test/resources/cubes.yaml</property>
</extension>
tomcat:
   image: tutum/tomcat:7.0
   exposedPorts: [8089/tcp]
portBindings:
   - exposedPort: 8089/tcp
     port: 8089

For a more complete overview of the configuration options please refer to the documentation.

Building images

If you would like to build an Docker image as part of the test as oppose to just consume a preexisting one you can refer to a directory with a DockerFile directly in the Cube configuration.

tomcat:
   buildImage:
     dockerfileLocation: src/test/resources/tomcat
     noCache: true
     remove: true
   exposedPorts: [8089/tcp]
portBindings:
   - exposedPort: 8089/tcp
     port: 8089

For more information on building please refer to the documentation.

Arquillian Container

Not only can you control the Docker images, Cube also integrates nicely with the normal Arquillian Remote Containers.

When a Arquillian Container has the same qualifier as a Docker image, Cube will assume that the Docker image contains the Container and control the Image in the same lifecycle as the Container it self. Starting it before BeforeStart and stopping it after AfterStop.

There are two potential problem areas when using Arquillian Remote Containers with Docker images;

Docker by default boot up images on ‘random’ IP addresses and the Container it self might be bound to 127.0.0.1 inside the Docker container and skew any management API responses that will effect it’s ability to do deployments, in-container testing and URL injection.

Arquillian Cube address these issues by automatically remapping and updating the Container configuration and the metadata returned by the Container. In the end, all you need to do is define the Docker image and the Arquillian Container with the same name and place the Remote adapter on classpath.

<extension qualifier="docker">
    <property name="dockerContainers">
       tomcat:
         image: tutum/tomcat:7.0
         exposedPorts: [8089/tcp]
       portBindings:
         - exposedPort: 8089/tcp
           port: 8089
    </property>
</extension>

<container qualifier="tomcat">
</container>

Documentation

For more information on how this all work, what you can configure etc please see the complete documentation

What’s coming next?

Next up for Cube is OpenShift 3/Kubernetes support. This should allow you to control images deployed on OpenShift Origin and not just via the normal Docker Server. Using the same implementation we hope to support Google Cloud Engine as well.

If you have any questions, problems or request: please drop us a note on the community forums.

What is Arquillian Cube Extension?

With Arquillian Cube you can control the lifecycle of Docker images as part of the test lifecyle, either automatically or manually. This gives you the chance to scale up from a integration/functional test level all the way up to the system test level.

Release details

Component Arquillian Cube Extension
Version 1.0.0.Alpha1 view tag
Release date 2014-11-15
Released by Aslak Knutsen
Compiled against

Published artifacts org.arquillian.cube

Release notes and resolved issues 21

Enhancement
Bug

Thanks to the following list of contributors: Alex Soto, Aslak Knutsen, Stefan Miklosovic