0

I build a maven project that contains only tests. These tests test a REST service running in a container on my machine. The tests run successfully on my machine with mvn test.

Now I want to build a container for my test project using Wercker. In other words: I want a container that tests a service running in another container. A simple build step like mvn test fails, for Wercker runs somewhere else and can't access my REST service on my machine.

Is it possible to make such a container that runs the tests only locally and not where Wercker makes the containers?

EdH
  • 5
  • 4

1 Answers1

1

You can use "services" to run additional containers in your pipeline. For example, say you have already built a container called "rest-server:latest" that has your REST server that you want to test in it. You can start that container up and then in your pipeline it will be available as "rest-server" so you can run your tests using that address.

So in your pipeline you could do something like:

test:
  services:
    - name: rest-server
      id: edh/rest-server
      cmd: java -jar /path/to/my-code.jar
  steps:
    - java/maven:
      goals: verify
      maven_opts: -DrestEndpoint=http://rest-server:9000

There are some more details about linking services here: http://devcenter.wercker.com/docs/services/linking-services

avojak
  • 2,342
  • 2
  • 26
  • 32