Arquillian Cube Extension 1.0.0.Alpha15 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.Alpha15 release of the Arquillian Cube Extension component!

Apart from bug fixes in the openshift module, we brought very anticipated new feature – support for Kubernetes. This was a joint effort with the amazing fabric-8 team.

New Features

Kubernetes Support

The kubernetes extension helps you write and run integration tests for your Kubernetes/Openshift application.

This extension will run tests in a black-box fashion, creating and managing a temporary namespace for your tests, apply all Kubernetes resources required to create your environment and once everything is ready it will run your tests. The tests will be enriched with resources required to access services. Finally when testing is over it will cleanup everything.

The test cases are meant to interact with the provided services and assert that the environment is in the expected state.

@RunWith(Arquillian.class)
public class HelloWorldTest {

    @Named("hello-world-service")
    @ArquillianResource
    Service helloWorld;

    @Test
    public void shouldShowHelloWorld() throws IOException {
        assertNotNull(helloWorld);
        assertNotNull(helloWorld.getSpec());
        assertNotNull(helloWorld.getSpec().getPorts());
        assertFalse(helloWorld.getSpec().getPorts().isEmpty());
    }
}

In this example, test reads for kubernetes.json file form the root of the classpath, deploys everything and injects Kubernetes components into the test. Notice that you can assert that elements are correctly configured as well as getting information for connecting to the services and validate they have been deployed correctly.

You can also import io.fabric8:kubernetes-assertions, which is built on top of excellent assertj project, you’ll be able to write assertions like:

@RunWith(Arquillian.class)
public class ExampleTest {

  @ArquillianResource
  KubernetesClient client;

  @ArquillianResource
  Session session;

  @Test
  public void testAtLeastOnePod() throws Exception {
    assertThat(client).pods()
                      .runningStatus()
                      .filterNamespace(session.getNamespace())
                      .hasSize(1);
  }
}

You can read more about Kubernetes integration at http://arquillian.org/arquillian-cube/#_kubernetes and full example at https://github.com/arquillian/arquillian-cube/tree/master/kubernetes/ftest-kubernetes

Fabric8 Support

The Fabric8 extension can be used along with the Kubernetes extension to provide a tighter integration with the Fabric8 Microservices Platform.

It provides Fabric8Label provider and Fabric8Annotation provider.

You can read more about Fabric 8 integration at http://arquillian.org/arquillian-cube/#_fabric8

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.Alpha15 view tag
Release date 2016-09-01
Released by Alex Soto
Compiled against

Published artifacts org.arquillian.cube

  • org.arquillian.cube » arquillian-cube-api jar javadoc pom
  • org.arquillian.cube » arquillian-cube-spi jar javadoc pom
  • org.arquillian.cube » arquillian-cube-core jar javadoc pom
  • org.arquillian.cube » arquillian-cube-containerless jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-drone jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-recorder jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-restassured jar javadoc pom
  • org.arquillian.cube » arquillian-cube-openshift jar javadoc pom
  • org.arquillian.cube » arquillian-cube-kubernetes-fabric8 jar javadoc pom
  • org.arquillian.cube » arquillian-cube-kubernetes jar javadoc pom
  • org.arquillian.cube » arquillian-cube-requirement jar javadoc pom

Release notes and resolved issues 1

Enhancement

Thanks to the following list of contributors: Ales Justin, Alex Soto, Jonh Wendell, Ioannis Canellos

Arquillian Cube Q 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 Q Extension component!

This is the first release of Arquillian Cube Q. Q is an extension of Arquillian Cube that allows you to write chaos tests. As in Cube, it relies on Docker to execute these kind of tests.

There are several level of chaos that you might introduce in order to verify how your services are behaving when unexpected happens. Starting from network chaos (latency, bandwidth limitation, …​) to operative system chaos (cpu burn, io burn, dill disk, …​). Arquillian Q as all the Arquillian projects, reuses existing chaos frameworks by integrating them into Arquillian universe.

Supported Chaos

Network Chaos

Arquillian Cube Q implements network chaos leveraging Toxiproxy project.

You can use following toxics:

A test with network chaos with Arquillian Cube Q looks like:

@RunWith(Arquillian.class)
public class ToxicFuntionalTestCase {

  @ArquillianResource
  private NetworkChaos networkChaos;

  @HostIp
  private String ip;

  @Test
  public void shouldAddLatency() throws Exception {
    networkChaos.on("pingpong", 8080).latency(latencyInMillis(4000))
      .exec(() -> {

        URL url = new URL("http://" + ip + ":" + 8081 + "/hw/HelloWorld");
        final long l = System.currentTimeMillis();
        String response = IOUtil.asString(url.openStream());
        System.out.println(response);
        System.out.println("Time:" + (System.currentTimeMillis() - l));
        // assertions
    });
  }
}

In this example, the communication with pingpong container on exposed port 8080 is toxified with a latency of 4 seconds.

You can read more about network chaos at https://github.com/arquillian/arquillian-cube-q#network-chaos and an example at https://github.com/arquillian/arquillian-cube-q/tree/master/ftest-toxic

Container Chaos

In order to introduce chaos to the container, Arquillian Q integrates with Pumba project.

It supports following toxics:

  • stopping a container
  • removing a container
  • killing a container process with a signal.

A test with container chaos with Arquillian Cube Q looks as simple as:

@RunWith(Arquillian.class)
public class PumbaFunctionalTestCase {

  @ArquillianResource
  ContainerChaos containerChaos;

  @ArquillianResource
  DockerClient dockerClient;

  @Test
  public void shouldKillContainers() throws Exception {
    containerChaos
            .onCubeDockerHost()
                .killRandomly(
                        ContainerChaos.ContainersType.regularExpression("^pingpong"),
                        ContainerChaos.IntervalType.intervalInSeconds(4),
                        ContainerChaos.KillSignal.SIGTERM
                )
            .exec();

        final List<Container> containers = dockerClient.listContainersCmd().exec();
        // Pumba container is not killed by itself
        assertThat(containers).hasSize(1);

    }

}

In this example, containers called pingpong are killed every 4 seconds.

You can read more about container chaos at https://github.com/arquillian/arquillian-cube-q#container-chaos and an example at https://github.com/arquillian/arquillian-cube-q/tree/master/ftest-pumba

Operative System Chaos

To do operative system chaos Arquillian Q uses some modified version of Netflix Simian Army project scripts.

At this moment we provide:

  • blocking a port
  • burning CPU or IO
  • filling the disk
  • killing the process
  • null route

Here’s the example of the test with operative system chaos using Arquillian Cube Q:

@RunWith(Arquillian.class)
public class SimianArmyFunctionalTestCase {

    @ArquillianResource
    OperativeSystemChaos operativeSystemChaos;

    @HostIp
    String dockerHost;

    @HostPort(containerName = "pingpong ", value = 8080)
    int port;

    @Test(expected = Exception.class)
    public void shouldExecuteBurnCpuChaos() throws Exception {
        operativeSystemChaos.on("pingpong")
            .burnCpu(singleCpu())
            .exec();
        //.....
    }
}

p.This test burns one of the CPU

You can read more about operative system chaos at https://github.com/arquillian/arquillian-cube-q#operative-system-chaos and an example at https://github.com/arquillian/arquillian-cube-q/tree/master/ftest-simianarmy

What’s Next

As it is an Alpha1 release, you might expect some changes in the API as we move towards the final version, although we will try hard to not break anything.

Currently the toxics are explicitly defined in the code, for example you statically define latency of 4 seconds. Next step is creating a random method using which you can randomize the parameters of the toxics. Similarly you would be able to randomize the order of applying toxics.

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian Cube Q Extension
Version 1.0.0.Alpha1 view tag
Release date 2016-08-29
Released by Alex Soto
Compiled against

Published artifacts org.arquillian.cube.q

  • org.arquillian.cube.q » arquillian-cube-q-api jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-spi jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-core jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-toxic jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-pumba jar javadoc pom
  • org.arquillian.cube.q » arquillian-cube-q-simianarmy jar javadoc pom

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

Arquillian Governor 1.0.3.Final 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.3.Final release of the Arquillian Governor component!

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian Governor
Version 1.0.3.Final view tag
Release date 2016-08-23
Released by Bartosz Majsak
Compiled against

Published artifacts org.arquillian.extension

  • org.arquillian.extension » arquillian-governor-spi jar javadoc pom
  • org.arquillian.extension » arquillian-governor-api jar javadoc pom
  • org.arquillian.extension » arquillian-governor jar javadoc pom
  • org.arquillian.extension » arquillian-governor-jira jar javadoc pom
  • org.arquillian.extension » arquillian-governor-skipper jar javadoc pom
  • org.arquillian.extension » arquillian-governor-github jar javadoc pom
  • org.arquillian.extension » arquillian-governor-redmine jar javadoc pom
  • org.arquillian.extension » arquillian-governor-ignore jar javadoc pom

Release notes and resolved issues 4

Other

Thanks to the following list of contributors: Bartosz Majsak, Martin Basovnik, Stefan Miklosovic, Ayman Abdel Ghany, Aslak Knutsen

Arquillian Cube Extension 1.0.0.Alpha14 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.Alpha14 release of the Arquillian Cube Extension component!

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.Alpha14 view tag
Release date 2016-08-18
Released by Alex Soto
Compiled against

Published artifacts org.arquillian.cube

  • org.arquillian.cube » arquillian-cube-api jar javadoc pom
  • org.arquillian.cube » arquillian-cube-spi jar javadoc pom
  • org.arquillian.cube » arquillian-cube-core jar javadoc pom
  • org.arquillian.cube » arquillian-cube-containerless jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-drone jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-recorder jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-restassured jar javadoc pom
  • org.arquillian.cube » arquillian-cube-openshift jar javadoc pom
  • org.arquillian.cube » arquillian-cube-kubernetes-fabric8 jar javadoc pom
  • org.arquillian.cube » arquillian-cube-kubernetes jar javadoc pom
  • org.arquillian.cube » arquillian-cube-requirement jar javadoc pom

Release notes and resolved issues 2

Bug
Other

Thanks to the following list of contributors: Alex Soto

Arquillian Cube Extension 1.0.0.Alpha13 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.Alpha13 release of the Arquillian Cube Extension component!

Apart from bug fixes and components upgrades that you can see in issues list at the bottom of this post, this release also contains a lot of new feature:

Important Change from Previous Releases

Changed default definition format

In Cube Alpha12 and below the default definition format was CUBE. This was in that way because at time of writing first version of Cube there was no docker-compose format. Now that docker-compose is the default format, Arquillian Cube interprets by default any orchestration file as docker-compose format.

If you are using CUBE format instead of docker-compose you will need to update your arquillian.xml file with next parameter:

<extension qualifier="docker">
  <property name="definitionFormat">CUBE</property>
</extension>

This change is important if you are updating from Alpha12 to Alpha13 and NOT using docker-compose. Of course if you’ve already using docker-compose format you can remove the definitionFormat entry from arquillian.xml file.

New Features

Arquillian Recorder integration

Arquillian Recorder project brings neat reports of your Arquillian tests. Now we are providing an integration to the project so that generated report contains also information about Cube and Docker such as Docker version used, Docker containers definition or an schema of the organization of each container.

p.To use it you only need to import recorder and cube-docker-recorder dependencies:

<dependency>
  <groupId>org.arquillian.extension</groupId>
  <artifactId>arquillian-recorder-reporter-impl</artifactId>
  <version>${version.arquillian.recorder}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.arquillian.cube</groupId>
  <artifactId>arquillian-cube-docker-recorder</artifactId>
  <version>${version.arquillian.cube}</version>
  <scope>test</scope>
</dependency>

You can read more about Arquillian Recorder integration in the recorder section of the Cube documentation.

Added manual attribute at CUBE format

Sometimes you don’t want that Cube starts a Docker container. You only want to have registered and start it when you need it inside test using CubeController. In these cases set manual attribute to true in the container definition.

tomcat:
  image: tutum/tomcat:7.0
  manual: true

In previous configuration you are setting that tomcat container will be started manually in the test (or Cube extension).

You can read more about manual attribute in the config section.

Integration with Arquillian Drone

Arquillian Drone is an Arquillian extension that basically manages Selenium WebDriver instances. Selenium community provides official Docker images with browser (Firefox or Chrome) and VNC server installed. This integration manages this integration automatically for you providing a correct configured WebDriver instance as well as Selenium container and VNC client for recording the session up and running. Finally it also integrates with Arquillian Recorder to provide link to the recording of the test.

To use it, apart from Arquillian Drone dependencies you only need to provide cube-docker-drone dependency:

<dependency>
  <groupId>org.arquillian.cube</groupId>
  <artifactId>arquillian-cube-docker-drone</artifactId>
  <scope>test</scope>
  <version>${version.arquillian.cube}</version>
</dependency>

You can read more about Arquillian Drone integration right here.

Integration with Arquillian Graphene

Arquillian Graphene is a wrapper around Arquillian Drone to provide a simplification in Page Object patter, AJAX testing or High Level find elements.

To use it, apart from Arquillian Graphene (and Arquillian Drone) dependencies you only need to add cube-docker-drone dependency. Cube will be smart enough to inspect classpath and decide to provide Graphene integration or not.

<dependency>
  <groupId>org.arquillian.cube</groupId>
  <artifactId>arquillian-cube-docker-drone</artifactId>
  <scope>test</scope>
  <version>${version.arquillian.cube}</version>
</dependency>

You can read more about Arquillian Graphene integration at http://arquillian.org/arquillian-cube/#_graphene.

Allow parallel execution of tests

One of the main problems when running Cube tests in parallel against same Docker host is that you cannot instantiate twice the same container due a conflict name (you cannot instantiate two containers with same name). To avoid this, star operator has been created for CUBE format.

The idea behind star operator is that if the name and links of a container contains symbol * then Arquillian Cube will change that part with a random UUID and updating the links accordantly.

For example:

<property name="dockerContainers">
  tomcat*:
    image: tutum/tomcat:8.0
    portBindings: [8080/tcp]
    links:
      - ping*
  ping*:
    image: jonmorehouse/ping-pong
    exposedPorts: [8089/tcp]
</property>

Might be executed to Docker host as:

<property name="dockerContainers">
  tomcat_123456:
    image: tutum/tomcat:8.0
    portBindings: [54678 -> 8080/tcp]
    env: [ping_HOSTNAME=ping_123456]
    links:
      - ping_123456
  ping_123456:
    image: jonmorehouse/ping-pong
    exposedPorts: [8089/tcp]
</property>

Notice that now the name is generated randomly. Now you can run tests in parallel against same Docker host.

Currently we are not providing a way for scaling in docker-compose format, but in next release we will offer this possibility as well.

You can read more about this feature at http://arquillian.org/arquillian-cube/#_parallel_execution.

Provide a mechanism for tests/suites to run if certain assumptions are satisfied

Sometimes you write a test and you want to force user to run a test against an specific docker machine. In these cases, if the machine where you are running the test does not contain a docker machine with this name, the result will be a failing test. But probably what you expect is to simply skip the test. This is what this feature provides.

To do it, you need to use ArquillianConditionalRunner or RequirementRule and import cube-requirement dependency:

<dependency>
  <groupId>org.arquillian.cube</groupId>
  <artifactId>arquillian-cube-requirement</artifactId>
  <scope>test</scope>
  <version>${version.arquillian.cube}</version>
</dependency>

And the test:
@RunWith(ArquillianConditionalRunner.class)
@RequiresDockerMachine(name = "dev")
public class HelloWorldServletTest {
   ...
}

This test is only executed if there is a docker machine named dev. If not, it is skipped.

You can read more about this feature at http://arquillian.org/arquillian-cube/#_requirements_module.

Integration with RestAssured

If you are using Docker and RestAssured for testing REST API, probably you have already faced the problem of having to configure RestAssured in all tests with an IP different than localhost and a port different of 8080. Instead of repeating this configuration code again and again in all your tests, Arquillian Cube can do it for you.

To do it you only need to add (apart from RestAssured dependency) the cube-docker-restassured dependency.

<dependency>
  <groupId>org.arquillian.cube</groupId>
  <artifactId>arquillian-cube-docker-restassured</artifactId>
  <scope>test</scope>
  <version>${version.arquillian.cube}</version>
</dependency>

You can read more about RestAssured integration at http://arquillian.org/arquillian-cube/#_rest_assured_integration.

Enrichment for Internal IP

Now you can enrich your tests with internal IP used in an specific container.

@CubeIp(containerName = “tomcat”)
String ip;

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.Alpha13 view tag
Release date 2016-08-17
Released by Alex Soto
Compiled against

Published artifacts org.arquillian.cube

  • org.arquillian.cube » arquillian-cube-api jar javadoc pom
  • org.arquillian.cube » arquillian-cube-spi jar javadoc pom
  • org.arquillian.cube » arquillian-cube-core jar javadoc pom
  • org.arquillian.cube » arquillian-cube-containerless jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-drone jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-recorder jar javadoc pom
  • org.arquillian.cube » arquillian-cube-docker-restassured jar javadoc pom
  • org.arquillian.cube » arquillian-cube-openshift jar javadoc pom
  • org.arquillian.cube » arquillian-cube-kubernetes-fabric8 jar javadoc pom
  • org.arquillian.cube » arquillian-cube-kubernetes jar javadoc pom
  • org.arquillian.cube » arquillian-cube-requirement jar javadoc pom

Release notes and resolved issues 21

Docker
Bug
Other
Documentation
Enhancement

Thanks to the following list of contributors: Ioannis Canellos, Alex Soto, Jonh Wendell, Filippe, Eddú Meléndez Gonzales, Stefan Miklosovic, Matous Jobanek, Aslak Knutsen