Arquillian Cube + Multiple Deployments


#1

I have developed a module in Arquillian Cube which allows you to run Spring Boot applications inside a Docker container so you can run integration tests against Spring Boot + Docker applications. What I am doing in this case is creating a runnable jar file with Shrinkwrap and then materialize it in Dockerfile directory, so developers can use Dockerfile to just copy that file inside the Docker container and then run it as standalone application inside Docker.

And this works perfectly, but I have found one use case which it may require some extra work and I would like to know your opinion. The use case is when you are using microservices and spring boot where you can have several spring boot runnable jars, all of them running on its own Docker container. And then you have one piece of code which aggregates the call to all these services. For example let’s say one microservice for getting a information from a movie, and another microservices which gets the comments written by users about that movie. Each one will run on its own docker container and it will be a piece of code that aggregates both calls.

So to write a test for this logic we need to deploy two archives in two docker containers. So I need a way that @Deployment method can return more than one Archive and of course the deploy method of adapter can receive more than one. The idea that comes to my mind is to create a new Archive called CompositeArchive which extends form Archive and internally stores a list of Archives. Then in adapter I will do an instance of and if it is of type composite I will spawn one container for each archive.

In fact is not as easy as this but for now the problem that I want to fix is how to create multiple archives. Do you think creating a new Archive is good approach? Any other idea?

Thank you so much.


#2

Wouldn’t this just be 2 containers with 2 targeted deployments?

arquillian.xml:

<group qualifier="group">
  <container qualifier="A" />
  <container qualifier="B" />
</group>
public class MyTestCase {
  
  @Deployment @TargetsContainer("A")
  public static Archive deployMovieService() {
    return ShrinkWrap.create...
  }

  @Deployment @TargetsContainer("B")
  public static Archive deployCommentService() {
    return ShrinkWrap.create...
  }
}

?