An open API service indexing awesome lists of open source software.

https://github.com/opennms/opennms-system-test-api

End-to-end test APIs for Minion/OpenNMS with Docker
https://github.com/opennms/opennms-system-test-api

Last synced: 11 months ago
JSON representation

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

Awesome Lists containing this project

README

          

= OpenNMS System Test API
:ascii-ids:
:encoding: UTF-8
:icons: font
:numbered:

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

== 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.

== Setup

=== 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)

=== Setup the Docker daemon

We use the link:https://github.com/spotify/docker-client[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.

=== Build the OpenNMS RPMs

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

After obtaining the link:http://www.opennms.org/wiki/Developing_with_Git[sources], run the following to build the RPMs:

[NOTE]
You currently need to checkout the +develop+ branch.

----
./makerpm.sh
export OPENNMS_BUILD=$(pwd)
----

=== 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.

== Developing tests

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

[source,java]
----
@ClassRule
public static System system = System.builder().skipTearDown(true).build();
----

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

[source,java]
----
@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)
----