OpenNMS / opennms-system-test-api

End-to-end test APIs for Minion/OpenNMS with Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenNMS System Test API

End-to-end test APIs for Minion/OpenNMS that leverage Docker for managing services.

1. Preface

The framework provides the ability to instantiate a system on the local, or a remote host using a collection of linked Docker containers. Once instantiated, references to the various hosts and ports for all of the services (i.e. OpenNMS HTTP, Minion Karaf Shell) are available, and control is passed to the test suite.

2. Setup

2.1. Requirements

  • Docker v1.10.x (tested with 1.10.3, build 20f81dd)

  • Maven v3.3.x (tested with 3.3.3)

  • Java 8 (tested with Oracle JDK 1.8.0_45-b14)

2.2. Setup the Docker daemon

We use the Spotify Docker Client to communicate with the Docker daemon.

The location of the Docker daemon can be controlled with the DOCKER_HOST environment variable. If the Docker daemon is running on the localhost, no extra configuration should be required. You may need to use unix:///var/run/docker.sock if your Docker daemon doesn’t listen on a TCP port.

2.3. Build the OpenNMS RPMs

The Docker images depend on the .rpms generated by the build.

After obtaining the sources, run the following to build the RPMs:

Note
You currently need to checkout the develop branch.
./makerpm.sh
export OPENNMS_BUILD=$(pwd)

2.4. Build the Docker images

Build the Docker images with:

pushd docker
./copy-rpms.sh
./build-docker-images.sh
popd
Note
The OPENNMS_BUILD environment variable is used by the copy-rpms.sh script to find the .rpms.
Note
You can also use the OPENNMS_RPM_ROOT environment variable to point to the directory containing RPMs for the copy-rpms.sh script.

3. Developing tests

When developing tests you can disable the automatic tear down of the containers after the test using:

@ClassRule
public static System system = System.builder().skipTearDown(true).build();

You can also run the tests against an existing environment using:

@ClassRule
public static System system = System.builder().useExisting(true).build();

If you want to destroy an existing environment you can kill and remove ALL of your containers using:

docker kill $(docker ps -q)
docker rm $(docker ps -a -q)

About

End-to-end test APIs for Minion/OpenNMS with Docker


Languages

Language:Java 82.5%Language:Shell 11.5%Language:Dockerfile 6.1%